Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Braytron5
New Member

Comparing and Calculating Sales for Two Independent Date Periods with Percentage Difference

Hello everyone,

I am working on a Power BI report where I want to compare sales (Net total) for two different time periods and then calculated difference show in percentage. I created two table visuals with two date slicers. Each slicer is interacting with one table. Total from those tables, I want to calculate and show in percentage. Problem is that slicers in new table visual do not show different value and calculation shows 0.Forum post.png

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Braytron5 

 

That isn't how crossfiltering works. While you can make a viz crossfilter  only a  specific viz, you cannot make it partially do so such that only a column or a measure is affected - it either crossfilters or it doesnt at all. In order to make a two-period comparison, you can't be using a range slicer as there aren't two ranges in there - only one - from the start to end date. A way to achieve this is by using a disconnected table for one of the measures. A disconnected date table can be created by referencing the related date table in a calculated table or by creating one in the query editor without relating it to the other fact/dim tables.

danextian_0-1734779676810.png

In the sceenshot  below, Period1 is just a simple as this will be filtered by the related date table.

Sales = 
SUM ( Sales[Sales Amount] )

 Period2 is as follows

Sales Period2 = 
CALCULATE (
    [Sales], 
    // Map the selected dates from the DisconnectedDate table to the 'Date' table, maintaining any existing filters on DisconnectedDate[Date].
    KEEPFILTERS ( TREATAS ( VALUES ( DisconnectedDate[Date] ), 'Date'[Date] ) ), 
    // Remove any filters applied directly to the 'Date' table to ensure TREATAS controls the filtering.
    REMOVEFILTERS ( 'Date' )
)

danextian_1-1734779799302.png

Please see sample pbix for the details.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @Braytron5 

 

That isn't how crossfiltering works. While you can make a viz crossfilter  only a  specific viz, you cannot make it partially do so such that only a column or a measure is affected - it either crossfilters or it doesnt at all. In order to make a two-period comparison, you can't be using a range slicer as there aren't two ranges in there - only one - from the start to end date. A way to achieve this is by using a disconnected table for one of the measures. A disconnected date table can be created by referencing the related date table in a calculated table or by creating one in the query editor without relating it to the other fact/dim tables.

danextian_0-1734779676810.png

In the sceenshot  below, Period1 is just a simple as this will be filtered by the related date table.

Sales = 
SUM ( Sales[Sales Amount] )

 Period2 is as follows

Sales Period2 = 
CALCULATE (
    [Sales], 
    // Map the selected dates from the DisconnectedDate table to the 'Date' table, maintaining any existing filters on DisconnectedDate[Date].
    KEEPFILTERS ( TREATAS ( VALUES ( DisconnectedDate[Date] ), 'Date'[Date] ) ), 
    // Remove any filters applied directly to the 'Date' table to ensure TREATAS controls the filtering.
    REMOVEFILTERS ( 'Date' )
)

danextian_1-1734779799302.png

Please see sample pbix for the details.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
DataNinja777
Super User
Super User

Hi @Braytron5 ,

 

To compare sales (Net Total) for two different time periods in Power BI using separate date slicers, the issue likely stems from slicers not being isolated properly. To resolve this, you need to use two independent date tables. Start by duplicating your existing Date Table and renaming the duplicates to Date1 and Date2. These tables should not have relationships with your fact table to ensure they function independently.

Next, create measures to calculate the Net Total for each period. For the first period, the measure would be:

Net Total Period 1 = 
CALCULATE(
    SUM(FactTable[Net Total]),
    TREATAS(VALUES(Date1[Date]), FactTable[Date])
)

For the second period, create a similar measure:

Net Total Period 2 = 
CALCULATE(
    SUM(FactTable[Net Total]),
    TREATAS(VALUES(Date2[Date]), FactTable[Date])
)

To calculate the percentage difference between the two periods, use a measure like this:

Percentage Difference = 
IF(
    [Net Total Period 1] = 0, 
    BLANK(), 
    ([Net Total Period 2] - [Net Total Period 1]) / [Net Total Period 1]
)

You can display these measures in a card or KPI visual. Ensure that the slicers for Date1 and Date2 interact only with their respective visuals by editing the interactions in Power BI. This setup ensures that the totals from the two different time periods are calculated independently and that the percentage difference is displayed correctly. If the slicers do not function as expected or show overlapping values, double-check that Date1 and Date2 are not related to the main Date table in your model.

 

Best regards,

Hi @DataNinja777
I had the same problem and your answer really helped me. I just have an issue now to visualize data using only period 1, because there is no relationships between the fields. Do I have to create another measure to resolve that?
Thank you!

Bibiano_Geraldo
Super User
Super User

Hi @Braytron5 ,

Its not clear for me, sorry.

I mean, the values are equal thats why is returning zero, because you selected the same date range in both slicer's.

 

Can you explain me more, please?

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors