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
Anonymous
Not applicable

Make DISTINCTCOUNT Measure ignore slicer

I have a table with multiple entries per user. Each entry represents an event (though that info is not relevant for this question).

user_idfilter
12330
123180
35530
35560
49090

 

The filter column determines if the event was sent X or less days ago. That is:

  1. 30 if the event was sent 30 or less days ago
  2. 60 if the event was sent between 31 and 60 days ago
  3. 90 if the event was sent between 61 and 90 days ago
  4. 60 if the event was sent between 91 and 180 days ago

I use this column as a Slicer to allow the user to select certain periods of time.

I made the following measure to count the number of users that have logged at least one event in the last X days (based on the value that the user sets the slicer to):

events_filtered = DISTINCTCOUNT(my_table[user_id])

I now want to create a measure that is not affected by the slicer. That is, a distinct count that ignores the slicer.
At first, I thought I could modify the interactions. However, I want to display both measures in a Multi-row card visual. Hence, how can I create a measure that calculates the grand total of the unique users in the table?
1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Anonymous ,

 

you can ignore a slicer with the ALL function. This function you can use as a context modifier in the CALCULATE function.

So the following approach should give you the result you want:

events_filtered =
CALCULATE (
    DISTINCTCOUNT ( my_table[user_id] ),
    ALL ( filter_Table[filter] )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

View solution in original post

1 REPLY 1
selimovd
Super User
Super User

Hey @Anonymous ,

 

you can ignore a slicer with the ALL function. This function you can use as a context modifier in the CALCULATE function.

So the following approach should give you the result you want:

events_filtered =
CALCULATE (
    DISTINCTCOUNT ( my_table[user_id] ),
    ALL ( filter_Table[filter] )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

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