Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a table 'ClientsList' with columns
ClientID | ClientRef | StartDate | EndDate | ActiveYN |
Adna yaxyx | 22936 | 19/04/2018 | Y | |
Agnzs Hznnzsszy | 17993 | 31/01/2018 | 24/04/2018 00:00 | N |
Axdan Cullzn | 22807 | 27/02/2018 | Y | |
Axdan O'Shza | 21791 | 22/02/2018 | Y |
I need the number of ClienID who were Active on 1/1/2018.
I have come up with this Measure but it's returning zero results.
Tot clients start of 2018 = CALCULATE(DISTINCTCOUNT(ClientsList[ClientRef]),FILTER(ClientsList,ClientsList[EndDate] >= DATE(2018,1,1)), ClientsList[StartDate] <= DATE(2017,12,31)) + CALCULATE(DISTINCTCOUNT(ClientsList[ClientRef]),FILTER(ClientsList,ClientsList[EndDate] = BLANK()),ClientsList[StartDate] <= DATE(2017,12,31)) - CALCULATE(DISTINCTCOUNT(ClientsList[ClientRef]),FILTER(ClientsList,ClientsList[EndDate] = BLANK()),ClientsList[StartDate] <= DATE(2018,1,1),ClientsList[ActiveYN] = "N") + 0
See attached sample data.
https://www.dropbox.com/s/r3mdt7wvg74z1m1/data.csv?dl=0
PLEASE, use this http://www.daxformatter.com/raw/
And try this:
Tot clients start of 2018 =
CALCULATE (
DISTINCTCOUNT ( ClientsList[ClientRef] );
ClientsList[EndDate] >= DATE ( 2018; 1; 1 ) ; ClientsList[StartDate] <= DATE ( 2017; 12; 31 ))
+ CALCULATE (
DISTINCTCOUNT ( ClientsList[ClientRef] );
ClientsList[EndDate] = BLANK () ; ClientsList[StartDate] <= DATE ( 2017; 12; 31 ))
- CALCULATE (
DISTINCTCOUNT ( ClientsList[ClientRef] );
ClientsList[EndDate] = BLANK () ; ClientsList[StartDate] <= DATE ( 2018; 1; 1 ) ; ClientsList[ActiveYN] = "N")
+ 0
Perhaps take a look at these two Quick Measures that I created to deal with date range type of issues:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365
https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
67 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |