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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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