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
olsen9
Frequent Visitor

Creating a RowNum but Sorted by Field

RowNum = 
CALCULATE (
    COUNT ( 'Table'[ID] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[ID]  <= MAX ( 'Table'[ID]  )
    )
)

Where can I add in sort by field in this equation? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @olsen9 ,

 

I think [RowNum] should be a measure based on your calculation logic. As far as I know, Power BI doesn't support us to add a measure to sort the columns.

For reference: 

Sort one column by another column in Power BI

Here I suggest you to create a Custom column in Power Query Editor and then use this function. If you sort a column by a calculated column which is calculated based on that column, Power BI will return a circule error.

 

Best Regards,
Rico Zhou

 

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

1 REPLY 1
Anonymous
Not applicable

Hi @olsen9 ,

 

I think [RowNum] should be a measure based on your calculation logic. As far as I know, Power BI doesn't support us to add a measure to sort the columns.

For reference: 

Sort one column by another column in Power BI

Here I suggest you to create a Custom column in Power Query Editor and then use this function. If you sort a column by a calculated column which is calculated based on that column, Power BI will return a circule error.

 

Best Regards,
Rico Zhou

 

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

 

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.