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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MichielvDuppen
New Member

Sort by one column in measure with switch statement

I created a switch measure to dynamically show the last 12 months including YTD and YTD LY comparisons into one table. 

MichielvDuppen_0-1644241079717.png

 

I visualized this measure in a pivot table where I would like to sort by one column in the switch statement (Sales YTD)

MichielvDuppen_1-1644241245648.png

 

How can I do this?

 

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @MichielvDuppen ,

 

You build a measure to show different measures in one by switch function. We couldn't sort this measure by one part measure in it.

I suggest you to add YTD measure into matrix value. Then sort by YTD measure.

Turn off word wrap function in visual format and reduce the width of columns to 0 which you don't want to see in matrix.

2.png

Result is as below.

1.png

You see my matrix is sort as descending by YTD measure.

 

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

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @MichielvDuppen ,

 

You build a measure to show different measures in one by switch function. We couldn't sort this measure by one part measure in it.

I suggest you to add YTD measure into matrix value. Then sort by YTD measure.

Turn off word wrap function in visual format and reduce the width of columns to 0 which you don't want to see in matrix.

2.png

Result is as below.

1.png

You see my matrix is sort as descending by YTD measure.

 

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.

Pragati11
Super User
Super User

HI @MichielvDuppen ,

 

On your table visual, if you click on 3 dots on the top-right, it gives you option to sort by whichever column you want. Something like below:

Pragati11_0-1644242120582.png

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

It does not, since I only have the measure with the switch expression in my pivot table.

MichielvDuppen_0-1644242256286.png

 

Hi @MichielvDuppen ,

 

I don't think you can sort this with the measure on the table.

Let me think if there is any other way to do this.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.