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
cristianml
Post Prodigy
Post Prodigy

Sort by Measure column

Hi,

i need to sort the pivot table by a column that is a Measure but it doesn't allow me to do it:

 

cristianml_0-1593439915994.png

How can I sort by this column (Risk Level) ?

1 ACCEPTED SOLUTION
edhans
Super User
Super User

You need to sort by column in the Power Pivot section. Measures are not columns, they just really float in the model. While they are stored in tables, they are not really part of the table and can be moved to other tables with no conseqeuence. It is why when you refer to a measure in another measure, you don't use the table name. Measures do not have a list of values in them. The measure is calculated each time it is encountered in the visual or pivot table based on the filter context. So there is nothing for the DAX engine to sort by.

 

You need to either:

  • create a custom column in Power Query, then use that column to sort on. This is the recommended way as Calculated Columns (next option) are best avoided when possible.
  • create a Calculated Column in DAX/Power Pivot.

In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

You need to sort by column in the Power Pivot section. Measures are not columns, they just really float in the model. While they are stored in tables, they are not really part of the table and can be moved to other tables with no conseqeuence. It is why when you refer to a measure in another measure, you don't use the table name. Measures do not have a list of values in them. The measure is calculated each time it is encountered in the visual or pivot table based on the filter context. So there is nothing for the DAX engine to sort by.

 

You need to either:

  • create a custom column in Power Query, then use that column to sort on. This is the recommended way as Calculated Columns (next option) are best avoided when possible.
  • create a Calculated Column in DAX/Power Pivot.

In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.