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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ayanmazumderpbi
Frequent Visitor

Count duplicate values and number them as 1,2,3 through measures

Hello Friends,

I need help on counting duplicate values and number them as 1,2,3 through measures. I have the following tables -

Account NumberMeter IDDate
11111111X11/1/2023 0:00
11111111X22/1/2023 0:00
11111111X33/1/2023 0:00
11111111X44/1/2023 0:00
11111111X55/1/2023 0:00
22222222X61/1/2023 0:00
22222222X72/1/2023 0:00
22222222X83/1/2023 0:00
33333333X94/1/2023 0:00
44444444X103/24/2023 0:00

 

I want to add a rank column which should be looking like

 

RankAccount NumberMeter IDDate
111111111X11/1/2023 0:00
211111111X22/1/2023 0:00
311111111X33/1/2023 0:00
411111111X44/1/2023 0:00
511111111X55/1/2023 0:00
122222222X61/1/2023 0:00
222222222X72/1/2023 0:00
322222222X83/1/2023 0:00
133333333X94/1/2023 0:00
144444444X103/24/2023 0:00

 

I am able to do that using calculated column but i am not able to create it through measure.

 

Any help and thoughts will be highly appriciated.

PowerBI File Link - https://drive.google.com/file/d/1C-zW3m1AgWw3qHcEj-8gL3FQr2ejWk2y/view?usp=sharing 

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@ayanmazumderpbi 

rank = 
RANKX (
    FILTER ( ALL ( tbl ), tbl[Account Number] = MAX ( tbl[Account Number] ) ),
    CALCULATE ( MAX ( tbl[Date] ) ),
    ,
    ASC,
    DENSE
)

 

smpa01_0-1676234129057.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

1 REPLY 1
smpa01
Super User
Super User

@ayanmazumderpbi 

rank = 
RANKX (
    FILTER ( ALL ( tbl ), tbl[Account Number] = MAX ( tbl[Account Number] ) ),
    CALCULATE ( MAX ( tbl[Date] ) ),
    ,
    ASC,
    DENSE
)

 

smpa01_0-1676234129057.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.