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
Anonymous
Not applicable

Rank by created date and company name

I have table Company. I need to display the TOP 6 recently created. Exemple of data:

 

jaweher89_0-1621888906578.png

 

 

Expected results

 

jaweher89_1-1621888943627.png

 

 

What I tried :

 

Rank = 

VAR d = Companies[CreatedDate].[Date] 

RETURN

    CALCULATE (

        RANK.EQ ( d, Companies[CreatedDate], DESC)

 

    )

the calculated column returned wrong values:

 

jaweher89_2-1621888983106.png

 

 

I need to order by creatd date, and when it's the same date, I need to order by Company Name

 

How to correct it

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Icey
Community Support
Community Support

Hi @Anonymous ,

 

You can also try this:

Measure =
RANKX (
    ALLSELECTED ( 'Table' ),
    RANKX (
        ALLSELECTED ( 'Table' ),
        CALCULATE ( MAX ( 'Table'[Created Date] ) ),
        ,
        DESC,
        DENSE
    ) * 100
        + RANKX (
            ALLSELECTED ( 'Table' ),
            CALCULATE ( MAX ( 'Table'[Company Name] ) ),
            ,
            DESC,
            DENSE
        ),
    ,
    ASC,
    DENSE
)

rank.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hi @Anonymous ,

 

You can also try this:

Measure =
RANKX (
    ALLSELECTED ( 'Table' ),
    RANKX (
        ALLSELECTED ( 'Table' ),
        CALCULATE ( MAX ( 'Table'[Created Date] ) ),
        ,
        DESC,
        DENSE
    ) * 100
        + RANKX (
            ALLSELECTED ( 'Table' ),
            CALCULATE ( MAX ( 'Table'[Company Name] ) ),
            ,
            DESC,
            DENSE
        ),
    ,
    ASC,
    DENSE
)

rank.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

@Anonymous Hmm. Well, you could try out the different options for RANKX instead of RANK.EQ. Provides some additional options around breaking ties and the like:

https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452

 

Also might try something like the Mythical DAX Index:

https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Mythical-DAX-Index/m-p/1093214#M528



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.