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.
Hello,
i have tried to find a solution on this forum, but im not an expert of DAX, especially when it involves dates...
I have a table with 2 columns (userID and Month):
July | UserA |
July | UserA |
July | UserB |
August | UserB |
August | UserC |
September | UserA |
September | UserD |
I need to display per month the total of distinct users but if they exist previously they should not be count again.
I should obtain:
I am able to get distinct count per month, but i cant manage to filter then if they exist previously or not..
Thank you for your help!
Solved! Go to Solution.
Hi @CG_pbi
First, add a new column with this code to convert Month Name to Number:
Month No. = month(DATEVALUE("2021/"&'Table'[Month]&"/1"))
Then use this measure to find the distinct count :
Measure =
VAR _A =
MAX ( 'Table'[Month No.] )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Table'[userID ] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month No.] <= _A )
)
output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Hi @CG_pbi
First, add a new column with this code to convert Month Name to Number:
Month No. = month(DATEVALUE("2021/"&'Table'[Month]&"/1"))
Then use this measure to find the distinct count :
Measure =
VAR _A =
MAX ( 'Table'[Month No.] )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Table'[userID ] ),
FILTER ( ALL ( 'Table' ), 'Table'[Month No.] <= _A )
)
output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
This works perfectly!! Thank you for your help !
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 |
---|---|
49 | |
27 | |
20 | |
15 | |
12 |
User | Count |
---|---|
58 | |
50 | |
44 | |
19 | |
18 |