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 column in my table that counts the number of days for each ID. However, that column skips numbers, when there are duplicate dates. I would like my column to show the same number for same date, but then go to the next number the following date and not jump to a higher number based on how many rows where in the previous date.
This is my measure:
Date rank by ID = CALCULATE(
COUNTROWS( 'Table'),
FILTER( ALL(Table), 'Table'[ID] = EARLIER(Table[ID]) &&
'Table'[Date] > EARLIER('Table'[Date]) ), ALLEXCEPT(Table, MeasureDB[Date]) ) + 1
Example output is this
Date | Rank date by ID | Output I would like |
1/1/2020 | 1 | 1 |
1/1/2020 | 1 | 1 |
1/1/2020 | 1 | 1 |
1/1/2020 | 1 | 1 |
1/2/2020 | 5 | 2 |
1/3/2020 | 6 | 3 |
1/4/2020 | 7 | 4 |
1/4/2020 | 7 | 4 |
1/4/2020 | 7 | 4 |
1/4/2020 | 7 | 4 |
1/5/2020 | 11 | 5 |
Thanks!
Solved! Go to Solution.
Try as new column
rankx(all('Table'),['Table'],,asc,dense)
Or Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
Appreciate your Kudos.
Hi @Anonymous
Use RANKX with "Dense" as the last argument, like RANKX( ,,,Dense ), please see the below example.
Rank Brand =
RANKX(
CALCULATETABLE(
VALUES( 'Product'[Brand] ),
ALLSELECTED()
),
CALCULATE(
SUMX(Sales, Sales[Net Price] * Sales[Quantity])
),,
DESC
)
Try as new column
rankx(all('Table'),['Table'],,asc,dense)
Or Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
Appreciate your Kudos.
Great! These articles were exactly what I was looking for!
Thanks
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 |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |