Forum Discussion
DISTINCTCOUNT DAX
Hello everyone,
I have calculated the number of clients using the "DISTINCTCOUNT" function. Now I need a slicer so that I can filter according to the number of clients, i.e. the number less than or equal to 2 or greater than 2. For example: if the number of clients is less than or equal to 2, it should return "1", otherwise "0".
Thanks
- Anonymous2 years ago
Hi Tito ,
I made simple samples and you can check the results below:
Measure = var _COUNT = CALCULATE(DISTINCTCOUNT('Table'[Clients]),ALLEXCEPT('Table','Table'[Name])) RETURN IF(_COUNT<=2,1,0)An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
8 Replies
- PhilipTreacy
Super User
Hi Tito
I'm not following what you wanrt really - how does it realte to the image you posted?
If you want a slicer, you'll need to create a table with the values you want the slicer to use.
Please supply our data/fiel so I can see what it is you are doing.
Regards
Phil
- Tito
Helper IV
Hallo PhilipTreacy
Vielen Dank für Ihre Antwort.
Ich möchte einen Datenschnitt erstellen, damit ich nach der Anzahl der Kunden filtern kann, also möchte ich in einer Tabelle sehen, wie viele kleiner oder gleich 2 und wie viele größer als 2 sind.
Mit freundlichen Grüßen
Tito
- AnonymousNot applicable
Hi Tito ,
I made simple samples and you can check the results below:
Measure = var _COUNT = CALCULATE(DISTINCTCOUNT('Table'[Clients]),ALLEXCEPT('Table','Table'[Name])) RETURN IF(_COUNT<=2,1,0)An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- Tito
Helper IV
Hi Anonymous ,
Thank you for your reply. This has helped me. Instead of "Measure" I have used a "calculated column".
- Tito
Helper IV
Hello everyone,
I have calculated the number of clients with DAX using the function "DISTINCTCOUNT". Now I want to have a slicer where I create a new measure: if the number of clients is < = 2, it should return "less than or equal to 2", otherwise " greater than 2".
Thanks
Tito- TomMartens
Super User
Hey Tito ,
unfortunately, it's not possible to use measures in combination with a slicer. This means you have to chck if you can meet your requirement using only calculated columns.
But then you have to be aware of the fact that calculated that calculated columns will only be evaluated during data refresh and not when slicer selections are changed by users.
Hopefully this helps to tackle your challenge.
Regards,
Tom
- Tito
Helper IV
Hi TomMartens
Do you have any suggestions on how I can solve this?Best regards
Tito
- Tito
Helper IV
Hi,
PhilipTreacy Is it clear now?Best regards
Tito