Thread

Power BI Sales Discrepancy Dive

Explore resolutions for Total Sales Discrepancy and Time Period Sales Discrepancy in Power BI with insights and solutions.

Empty image or helper icon

Power BI Sales Discrepancy Dive

Description

Explore resolutions for Total Sales Discrepancy and Time Period Sales Discrepancy in Power BI with insights and solutions.

Power BI Total Sales Discrepancy Issue Resolution

Tool: Languages Advisor

Created: 03/24/2024

Prompt

Hi,

I am creating a report where I have 1 sales fact table, with 2 attributed dim_date table (one for each slicer).
I require the total sales for these periods, where each measure will relate to each of the 2 period date slicers. Although I have referred to each of the dim_date tables individually in both of the measures, the total sales for these periods display the same results.

Iā€™m interested to hear a solution for this please,
Thanks

Issue:

  • Total sales for different time periods selected using separate date slicers are displaying the same results in Power BI.

Solution:

  1. Create Separate Measures:

    • Create two separate measures for total sales based on each period selected using the date slicers.
  2. Use CALCULATE Function with FILTER Context:

    • Inside each measure, use the CALCULATE function combined with FILTER to calculate total sales based on the selected period.
  3. Apply Different Filter Context:

    • Specify different filter contexts for each measure by using the respective date columns from the attributed dim_date tables.
  4. Sample Measures (Update based on your data model):

TotalSales_Period1 =
CALCULATE(
    SUM('Sales'[SalesAmount]),
    FILTER('Sales', 'Sales'[Date] IN DATESBETWEEN('dim_date1'[DateColumn], FIRSTDATE('dim_date1'[DateColumn]), LASTDATE('dim_date1'[DateColumn]))
)

TotalSales_Period2 =
CALCULATE(
    SUM('Sales'[SalesAmount]),
    FILTER('Sales', 'Sales'[Date] IN DATESBETWEEN('dim_date2'[DateColumn], FIRSTDATE('dim_date2'[DateColumn]), LASTDATE('dim_date2'[DateColumn]))
)

Benefits:

  • By creating separate measures with unique filter contexts, you can accurately calculate total sales for each specified period based on the slicer selection.
  • This approach ensures that each measure relates to the correct date slicer and provides distinct results.

By following the outlined solution, you should be able to resolve the issue of displaying the same total sales results for different time periods selected using separate date slicers in Power BI.

Disconnected Tables Solution for Time Period Sales Discrepancy in

Tool: Skills Advisor

Created: 03/24/2024

Prompt

I believe this can only be solved with disconnected tables in my data model can you confirm and detail if this is correct for power bi - Hi,

I am creating a report where I have 1 sales fact table, with 2 attributed dim_date table (one for each slicer).
I require the total sales for these periods, where each measure will relate to each of the 2 period date slicers. Although I have referred to each of the dim_date tables individually in both of the measures, the total sales for these periods display the same results.

Iā€™m interested to hear a solution for this please,
Thanks

Data Modeling Solution for Power BI

Problem Analysis:

  • You are dealing with 2 attributed dim_date tables in your data model for different time periods.
  • The total sales for these periods display the same results despite referring to each dim_date table individually in both measures.

Proposed Solution:

  1. Disconnected Tables:

    • Utilize disconnected tables to address this issue in Power BI.
  2. Steps to Implement Disconnected Tables:

    • Create separate disconnected tables for each dim_date table.
    • Relate these disconnected tables to the fact_sales table using inactive relationships.
    • Modify your measures to consider these inactive relationships for the respective time periods.
  3. Example (DAX Code):

Total Sales Period 1 = 
CALCULATE(
    [Total Sales],
    USERELATIONSHIP('fact_sales'[Date], 'dim_date_period1'[Date])
)

Total Sales Period 2 = 
CALCULATE(
    [Total Sales],
    USERELATIONSHIP('fact_sales'[Date], 'dim_date_period2'[Date])
)

Benefits of Disconnected Tables:

  • Helps in creating separate contexts for each time period slicer.
  • Allows you to calculate measures independently for different date selections.

Final Recommendations:

  • Implement disconnected tables with inactive relationships to create distinct filters for each period.
  • Adjust measures to incorporate the correct relationships based on the selected time period slicer.

By following these steps, you can ensure that your measures correctly display total sales for the respective periods based on the selected date slicers in your Power BI report.