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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AyoubDE
Frequent Visitor

Help Needed: Power BI Cards Returning 0 After Slicer Application

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 

>= date(2024, 07, 01) &&
<= date(2024, 07, 31)
it works perfcetly but whne use min and max don't works

AyoubDE_0-1723300288435.png

 

1 ACCEPTED SOLUTION
v-yohua-msft
Community Support
Community Support

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:

vyohuamsft_0-1723431545785.png

 

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]

 

vyohuamsft_1-1723431687749.png

 

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.

View solution in original post

3 REPLIES 3
v-yohua-msft
Community Support
Community Support

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:

vyohuamsft_0-1723431545785.png

 

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]

 

vyohuamsft_1-1723431687749.png

 

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.

mickey64
Super User
Super User

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) )

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Top Solution Authors