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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
FARIDMD
Regular Visitor

Find the Count after filter is set

Hi,

 

I need assistance from expert to find the number of count after filter is set.

 

I have total count of name from a set of date range. For example from 8/11/2021 - 21/09/2023 i have 2595 count of name.

 

FARIDMD_0-1695973528375.png

 

Then i set the slicer, from 08/11/2021 - 31/7/2022 i have 412 count of names.

 

FARIDMD_1-1695973602491.png

 

How do I get the difference in count, Difference =2183. ( 2595 - 412) , in Dax and show in a card. 2183 will change everytime i adjus the slicer.

 

Thank you 🙂

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

Hi @FARIDMD ,

 

As ChiragGarg2512 mentioned above, Power BI won't store the snapshot value when you change the slicer.

I suggest you to create two unrelated Calendar table for two slicers.

vrzhoumsft_0-1696231668323.png

Then use USERELATIONSHIP() function. Measures:

 

Count of Name 1 = 
CALCULATE(COUNT('Table'[Name]),USERELATIONSHIP('Table'[Date],'Slicer 1'[Date]))
Count of Name 2 = 
CALCULATE(COUNT('Table'[Name]),USERELATIONSHIP('Table'[Date],'Slicer 2'[Date]))
Difference = [Count of Name 1] - [Count of Name 2]

 

Result is as below.

vrzhoumsft_5-1696231869711.png

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @FARIDMD ,

 

As ChiragGarg2512 mentioned above, Power BI won't store the snapshot value when you change the slicer.

I suggest you to create two unrelated Calendar table for two slicers.

vrzhoumsft_0-1696231668323.png

Then use USERELATIONSHIP() function. Measures:

 

Count of Name 1 = 
CALCULATE(COUNT('Table'[Name]),USERELATIONSHIP('Table'[Date],'Slicer 1'[Date]))
Count of Name 2 = 
CALCULATE(COUNT('Table'[Name]),USERELATIONSHIP('Table'[Date],'Slicer 2'[Date]))
Difference = [Count of Name 1] - [Count of Name 2]

 

Result is as below.

vrzhoumsft_5-1696231869711.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ChiragGarg2512
Super User
Super User

@FARIDMD , This will require two separate slicers, otherwise a snapshot value[value coming after a filter] cannot be stored. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.