Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I'm working with two date slicers in Power BI, each applied to two separate cards. Each card displays a value based on the selected date range from its respective slicer.
For example:
- Card 1: Displays value X filtered by Date Slicer 1.
- Card 2: Displays value Y filtered by Date Slicer 2.
I then want to create a third card (Card 3) that calculates the difference between Y and X. However, I'm encountering an issue where the result is always 0 because the slicer filters are not being applied correctly.
Has anyone experienced a similar problem, or does anyone have a solution?
Thanks!
NB: if i use static dates like this
Solved! Go to Solution.
Hi, @AyoubDE
Are you unreassociating both slicers from the third card when editing interactions? If so, the two measures in the third card may be the same because there is no slicer effect, so it is 0. After testing, you should have no problem with the measure below, but you need to take it apart and then make a difference between the two.
Based on your information, I create a sample tables:
Create two static measures and a measure for the difference:
Measure_August = CALCULATE(
SUM('Table'[Total_CleanCode_From24/06/24TO06/08/2024]),
FILTER('Table', 'Table'[Date] >= DATE(2024, 8, 1) && 'Table'[Date] <= DATE(2024, 8, 6))
)
Measure_July = CALCULATE(
SUM('Table'[Total_CleanCode_From24/06/24TO06/08/2024]),
FILTER('Table', 'Table'[Date] >= DATE(2024, 7, 1) && 'Table'[Date] <= DATE(2024, 7, 6))
)
staticDifference = [Measure_July]-[Measure_August]
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @AyoubDE
Are you unreassociating both slicers from the third card when editing interactions? If so, the two measures in the third card may be the same because there is no slicer effect, so it is 0. After testing, you should have no problem with the measure below, but you need to take it apart and then make a difference between the two.
Based on your information, I create a sample tables:
Create two static measures and a measure for the difference:
Measure_August = CALCULATE(
SUM('Table'[Total_CleanCode_From24/06/24TO06/08/2024]),
FILTER('Table', 'Table'[Date] >= DATE(2024, 8, 1) && 'Table'[Date] <= DATE(2024, 8, 6))
)
Measure_July = CALCULATE(
SUM('Table'[Total_CleanCode_From24/06/24TO06/08/2024]),
FILTER('Table', 'Table'[Date] >= DATE(2024, 7, 1) && 'Table'[Date] <= DATE(2024, 7, 6))
)
staticDifference = [Measure_July]-[Measure_August]
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For your reference.
Measure = DATEDIFF(MIN('Table'[Date]),MAX('Table'[Date]),DAY)
Thank you for your solution but i got always the same issue by the way it works when using static date values zaama = CALCULATE( ('All_Reports_24-07-2024'[Total_CleanCode_From24/06/24TO06/08/2024]), 'DateDimension'[Date] >= DATE(2024, 7, 1) && 'DateDimension'[Date] <= DATE(2024, 7, 31) )- CALCULATE( ('All_Reports_24-07-2024'[Total_CleanCode_From24/06/24TO06/08/2024]), 'DateDimension'[Date] >= DATE(2024, 8, 1) && 'DateDimension'[Date] <= DATE(2024, 8, 6) )