Languages Advisor | Power BI

Power BI Total Sales Discrepancy Issue Resolution

Learn how to resolve the issue of displaying identical total sales for different time periods selected using separate date slicers in Power BI by creating distinct measures with unique filter contexts.


Empty image or helper icon

This Query related with thread "Power BI Sales Discrepancy Dive"

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

Answer

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.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

Learn how to resolve the issue of displaying identical total sales for different time periods selected using separate date slicers in Power BI by creating distinct measures with unique filter contexts.