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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AvPowerBI
Post Patron
Post Patron

Rank Dates

Hi,

 

I want to do a Rank function which is based on the columns TableName, Group and DateTime

So for the latest DateTime for each TableName that is in the Group I want that to be ranked as 1

e.g

TableName = Sales

Group =  AreaA

DateTime = 03/04/2022 22:00:03

Rank = 1

 

Current Results

AvPowerBI_2-1650481579620.png

 

New Results with Ranks Column

AvPowerBI_3-1650481603304.png

 

 

Thanks

 

2 ACCEPTED SOLUTIONS
SpartaBI
Community Champion
Community Champion

 

@AvPowerBI 

Rank = 
VAR _name = 'Table'[TableName]
VAR _group = 'Table'[Group]
VAR _result = 
RANKX(
    FILTER(
        ALL('Table'),
        'Table'[TableName] = _name
         && 'Table'[Group] = _group
    ),
    'Table'[DateTime],
    ,
    DESC
)
RETURN
    _result

 

 

View solution in original post

tackytechtom
Super User
Super User

Hi @AvPowerBI ,

 

Here a solution:

tomfox_0-1650483428519.png

 

And here the DAX:

TomsRankColumn = 
RANKX ( 
    FILTER ( 
        'Table', 
        'Table'[TableName] = EARLIER ( 'Table'[TableName] ) &&
        'Table'[Group] = EARLIER ( 'Table'[Group] )
    ),
    'Table'[DateTime],
    , DESC
    , DENSE
)

Let me know if this works for you 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @AvPowerBI ,

 

Here a solution:

tomfox_0-1650483428519.png

 

And here the DAX:

TomsRankColumn = 
RANKX ( 
    FILTER ( 
        'Table', 
        'Table'[TableName] = EARLIER ( 'Table'[TableName] ) &&
        'Table'[Group] = EARLIER ( 'Table'[Group] )
    ),
    'Table'[DateTime],
    , DESC
    , DENSE
)

Let me know if this works for you 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

SpartaBI
Community Champion
Community Champion

 

@AvPowerBI 

Rank = 
VAR _name = 'Table'[TableName]
VAR _group = 'Table'[Group]
VAR _result = 
RANKX(
    FILTER(
        ALL('Table'),
        'Table'[TableName] = _name
         && 'Table'[Group] = _group
    ),
    'Table'[DateTime],
    ,
    DESC
)
RETURN
    _result

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.