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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Yousra-ali
New Member

Periods Comparison

Hello Dears,

 

i have created table date and dublictae it and call it comparison, i have linked it to the main sales table i have, so now i have 2 slicer one is current period and the other one is past period with a matrix table have the type of the product as a coulomn and the ttl sales of current period and the past period, so it will look like belwo.

then i have created a measure 

P.P TTL SAL =
CALCULATE(
    [Total Sales Measure],
    ALL('23-24'[Calendar Date]),
    USERELATIONSHIP('23-24'[Calendar Date], 'Comparison'[Date]))
Picture1.png

to keep the first slicer not effcting the sales of the past period in the matrix table.
 
i hope it was clear, kindly let me know if you needed more info to help.
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Yousra-ali 

 

If the goal is to compare to periods controlled by different slicers, use a second dates/calendar table that has an active relationship to your fact table. Invoke the inactive relationship in a table using USERELATIONSHIP. You also need to remove the filter coming from the dates table with an active relationship to fact

Total Revenue Comparison = 
CALCULATE (
    [Total Revenue],
    USERELATIONSHIP ( ComparisonDates[Date], Data[Date] ), 
    REMOVEFILTERS ( Dates )
)

danextian_0-1757495203389.gif

 

 

Please see the attached pbix.





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

3 REPLIES 3
danextian
Super User
Super User

Hi @Yousra-ali 

 

If the goal is to compare to periods controlled by different slicers, use a second dates/calendar table that has an active relationship to your fact table. Invoke the inactive relationship in a table using USERELATIONSHIP. You also need to remove the filter coming from the dates table with an active relationship to fact

Total Revenue Comparison = 
CALCULATE (
    [Total Revenue],
    USERELATIONSHIP ( ComparisonDates[Date], Data[Date] ), 
    REMOVEFILTERS ( Dates )
)

danextian_0-1757495203389.gif

 

 

Please see the attached pbix.





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.

Thank you so much @danextian 

Cookistador
Super User
Super User

Hello @Yousra-ali 

 

As you have two sclicers, the best thing to do is to disconnected your second date dimension and in the measure used something like:

P.P TTL SAL =
VAR SelectedDate = SELECTEDVALUE('Date'[Date],blank())
RETURN
CALCULATE(
   [YourMeasure],
ALL(...)
    'Table'[Date] = SelectedDate)
If you need more help to set up the measure, do not hesistate to share a dummy dataset 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.