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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
James13
Frequent Visitor

Sequencing a calculated Table

Hi guys have a question if it is posible to sequence numbering base on the score column in this kind of calculated table in power bi 

James13_0-1724252277331.png

I tried the RANKX formula but as you can see at the photo the duplicates score only has 1 same sequence number


Is it posible to have this kind of view in a calculated table 

James13_1-1724252666687.png

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@James13 You need the Mythical DAX Index. The Mythical DAX Index - Microsoft Fabric Community

PBIX is attached below signature.

Table 2 = 
    VAR __SourceTable = 'Table'
    VAR __Count = COUNTROWS( __SourceTable )
    VAR __SortText = CONCATENATEX( __SourceTable, [ID], "|" )
    VAR __Table = 
        ADDCOLUMNS(
            GENERATESERIES( 1, __Count, 1 ),
            "__ID", PATHITEM( __SortText, [Value], TEXT )
        )
    VAR __Result =
        ADDCOLUMNS(
            __SourceTable,
            "seq", MAXX( FILTER( __Table, [__ID] = [ID] ), [Value] )
        )
RETURN
    __Result

 



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@James13 Yes, the 4th and 5th parameters of CONCATENATEX handle what to sort by and the sort direction.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@James13 You need the Mythical DAX Index. The Mythical DAX Index - Microsoft Fabric Community

PBIX is attached below signature.

Table 2 = 
    VAR __SourceTable = 'Table'
    VAR __Count = COUNTROWS( __SourceTable )
    VAR __SortText = CONCATENATEX( __SourceTable, [ID], "|" )
    VAR __Table = 
        ADDCOLUMNS(
            GENERATESERIES( 1, __Count, 1 ),
            "__ID", PATHITEM( __SortText, [Value], TEXT )
        )
    VAR __Result =
        ADDCOLUMNS(
            __SourceTable,
            "seq", MAXX( FILTER( __Table, [__ID] = [ID] ), [Value] )
        )
RETURN
    __Result

 



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

is it posbile to sort it to score in desc order? because i want to put another column to identify the Q1 Q2 Q3 Q4

 

@James13 Yes, the 4th and 5th parameters of CONCATENATEX handle what to sort by and the sort direction.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thanks sir, much appreciated.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.