Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Rank dates, but don't skip numbers

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

DateRank date by IDOutput I would like
1/1/202011
1/1/202011
1/1/202011
1/1/202011
1/2/202052
1/3/202063
1/4/202074
1/4/202074
1/4/202074
1/4/202074
1/5/2020115

 

Thanks!

1 ACCEPTED SOLUTION
3 REPLIES 3
Mariusz
Community Champion
Community Champion

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
) 

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

amitchandak
Super User
Super User
Anonymous
Not applicable

Great! These articles were exactly what I was looking for!

Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.