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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
casperlow
Helper I
Helper I

RANK and order by ID and Date

Hi Dax Gurus,

 

Needing a little help here.

 

I'm struggling to order this ranking by ID and Date.

Currently my dax is only ordering by ID.
See table below:

casperlow_0-1664263484137.png

 



See query below:

 

CS RankOrder = --Continious shift rank order
VAR CShiftID =
CALCULATETABLE(
    VALUES('Fact Visit'[Continuous Shift ID]),
    ALLSELECTED()
)
VAR CurrentORder =
SELECTEDVALUE('Fact Visit'[Continuous Shift ID])
VAR Result =
    IF(
        HASONEVALUE('Fact Visit'[Continuous Shift ID]),
        RANKX (
            CShiftID,
            'Fact Visit'[Continuous Shift ID],
            CurrentORder,
            ASC
        )
    )
RETURN
Result

Looking for your help here!
many thanks

 

2 REPLIES 2
wdx223_Daniel
Super User
Super User

CS RankOrder = --Continious shift rank order
VAR CShiftID =
CALCULATETABLE(
    SUMMARIZE('Fact Visit','Fact Visit'[Continuous Shift ID],'Fact Visit'[Start Date]),
    ALLSELECTED()
)
VAR CurrentORder =
SELECTEDVALUE('Fact Visit'[Continuous Shift ID])&SELECTEDVALUE('Fact Visit'[Start Date])
VAR Result =
    IF(
        HASONEVALUE('Fact Visit'[Continuous Shift ID]),
        RANKX (
            CShiftID,
            'Fact Visit'[Continuous Shift ID]&'Fact Visit'[Start Date],
            CurrentORder,
            ASC
        )
    )
RETURN
Result

Hi Daniel,
Apologies I might have ask the wrong question. but technically you did answer the question well.
I did a similar dax for this with date but it doesn't group it with the same continuous_shift_id.

Column CS TEST Rank is the dax formula you gave. See image below.

I guess do you have any suggestion on how do I tackle this?
casperlow_0-1664329985544.png

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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