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
314ter
Regular Visitor

ranknumber in one day

Hi,

 

I should create a ranknumber but can not find how.  I have a list of vessels with their departure date and departure time.

Sometimes multiple vessels are leaving the same day. For that day I would like to give them a ranknumber in the order they left.

So the first that day, the second, ...; I should become the table as shown below.  Unfortunatly could not find the right manner or DAX code to do so.  Thanks to anybody who could help me out!

 

Capture.PNG

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@314ter

 

You can use this calculated column

 

RANK Column =
RANKX (
    FILTER ( Table1, [Departure Date] = EARLIER ( [Departure Date] ) ),
    [Departure Time],
    ,
    ASC,
    DENSE
)

Regards
Zubair

Please try my custom visuals

View solution in original post

@314ter

 

It works when i use some sample rows like your data

Could your Departure Date (for each day) be different due to time element

If it it is use this MEASURE

 

RANK =
RANKX (
    FILTER (
        Table1,
        DATEVALUE ( [Deaprture Date] ) = DATEVALUE ( EARLIER ( [Deaprture Date] ) )
    ),
    [Departure Time],
    ,
    ASC,
    DENSE
)

 

rankperday.png


Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@314ter

 

You can use this calculated column

 

RANK Column =
RANKX (
    FILTER ( Table1, [Departure Date] = EARLIER ( [Departure Date] ) ),
    [Departure Time],
    ,
    ASC,
    DENSE
)

Regards
Zubair

Please try my custom visuals

Thanks, but unfortunately the output is only 1.

@314ter

 

It works when i use some sample rows like your data

Could your Departure Date (for each day) be different due to time element

If it it is use this MEASURE

 

RANK =
RANKX (
    FILTER (
        Table1,
        DATEVALUE ( [Deaprture Date] ) = DATEVALUE ( EARLIER ( [Deaprture Date] ) )
    ),
    [Departure Time],
    ,
    ASC,
    DENSE
)

 

rankperday.png


Regards
Zubair

Please try my custom visuals

Thanks a lot Zubair! Indeed, I send you this example but am acually working on another file (confidential info). There it didn't work, but it the example it does.  So yes must be something with the date value!  Thanks a lot!

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.