Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hello everybody,
I have got a problem with using distinct values.
Some context:
I'm working with a dashboard where people can select a beginning and ending date with two slicers. I harvest these slicers into a measure (using values) , which i used to create Variables called dynamicbegin and dynamicend (which represents the beginning and end of the period that people choose on the dashboard).
Now I want to count the unique values of a column called "Combinatie BSN & ZIN" (which has starting and end dates in the table it is from), for where OR the beginning OR the end is inside of the selected period (which is selected by user on dashboard).
I figured out a logic to do this. I first distinctcount all the values in column "Combinatie BSN & ZIN". Then i substract the values from that column of which the starting date is AFTER the ending date of the selected period OR where the ending date is BEFORE
the selected period. This measure is down below.
TESTING =
VAR dynamicbegin = [Dynamisch begindatum]
VAR dynamicend = [Dynamisch einddatum]
RETURN
CALCULATE(DISTINCTCOUNT('Data verstrekkingen'[combinatie BSN & ZIN])
-
CALCULATE(DISTINCTCOUNT('Data verstrekkingen'[combinatie BSN & ZIN]);
FILTER('Data verstrekkingen';'Data verstrekkingen'[Product begindatum]>dynamicend ||
'Data verstrekkingen'[Product einddatum] < dynamicbegin)))
This logic works perfeclty fine. I already double checked.
Except for the distinct values part. Because I use a or statement (the double pipe symbol "||") there are still duplicates. It unduplicates the part before and after the "||" symbol, but because of that there are still duplicates between those two groups, that are not made unique.
Is there a method to again distinct out all the values from the bottom part of the formula? So of this part.
CALCULATE(DISTINCTCOUNT('Data verstrekkingen'[combinatie BSN & ZIN]);
FILTER('Data verstrekkingen';'Data verstrekkingen'[Product begindatum]>dynamicend ||
'Data verstrekkingen'[Product einddatum] < dynamicbegin))Or do I (instead of the or "||" statement ) have to split this specific part into two measures and then distinct out those two measures? (If yes how do i do this)
Would be very gratefull if someone has a sollution!
Greatings.
Lucas
Hi @Anonymous,
How about using Or instead of ||?
CALCULATE(DISTINCTCOUNT('Data verstrekkingen'[combinatie BSN & ZIN]);
FILTER('Data verstrekkingen';'OR(Data verstrekkingen'[Product begindatum]>dynamicend,
'Data verstrekkingen'[Product einddatum] < dynamicbegin))
Regards,
Frank
Thanks for your respons! I tried it, but sadly it does not work. It gives the same result as with the "||" symbol. Have you got any other suggestions?
Hi @Anonymous,
Could you please share your sample data and excepted result to me, if you don't have confidential data? Please upload your file to One Drive and share the link here.
Regards,
Frank
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 29 | |
| 27 | |
| 25 | |
| 25 | |
| 18 |
| User | Count |
|---|---|
| 54 | |
| 49 | |
| 43 | |
| 36 | |
| 32 |