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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
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.