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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
rpinxt
Solution Sage
Solution Sage

Sorting on Parameter fields measures

So did already somebody found a solution to the sorting problem that arises when using the new Parameter Field function?

rpinxt_0-1666270611594.png

It is really great for switching between Quantity and values but it screws up sorting if you want to sort

it by Quantity or Values showing highest values first.

1 ACCEPTED SOLUTION
rpinxt
Solution Sage
Solution Sage

@v-yadongf-msft well yeah of course I can sort it manually but the whole purpose of using Power BI is to make data handling better, easier to use and visually better than manual work 😁.

Anyway thru several online post I came up with a solution myself for this problem.

First of you need to make an extera column in the parameter field table:

rpinxt_0-1666338755925.png

It is a copy of the main column in the table but for some reason you cannot use that one.

(getting error about the composite key etc)

 

When you have that you kan make a variable Rank Measure like:

rpinxt_1-1666339364388.png

And when you switch to USD view:

rpinxt_2-1666339430628.png

Works like a charm! 😁

 

And if you don't want to show the rank measure in your visual you can turn word wrap of in column header and the values and then you can just hide the column by sliding the width all to the left making it so narrow that it will nog show anymore.

For a chart even more easy, you just put it in the tooltips and then you can still sort on it but it won't show in the graph.

View solution in original post

8 REPLIES 8
craig_morey
Frequent Visitor

Thanks for posting this, I had the same problem with a slight twist, and you helped me most of the way to a solution.

Just quickly to redescribe the problem, I had a chronological graph that I wanted to swap between showing years, months, weeks etc. PowerBI "Parameters" seemed a perfect fit for use-case, but when you click between periods options, it would lose the sorting of the X-axis (only on some types of periods, not others - which I still don't understand), falling back to sorting by Y-axis, leaving you with a graph that made no sense like this:
Screenshot 2025-05-07 at 09.29.45.png

so, like you said, I added in an extra column in the parameter:

Screenshot 2025-05-07 at 09.52.06.png

Then, made a new measure that calculated a rank depending on what the parameter setting was. Note that here the calendar is held in the table "DimCalendar" and the data I'm showing in the graph is in the table "All_Cases":

Screenshot 2025-05-07 at 10.01.29.png

 

And then I just needed to add that new "RankingPeriod" measure to the tooltips of the chart, and then sort the graph by it (I'm not 100% sure why it only works when sorting DESC, but I'm sure someone smarter will tell me):

Screenshot 2025-05-07 at 10.00.49.png
and hey-presto, it works as it should:

Screenshot 2025-05-07 at 09.29.24.png

 

Thanks again... I'm still quite confused why this fairly simple use-case is so tricky in PowerBI, but hey, who knows.

mo_nasser1
Frequent Visitor

I think because The Origin Dim Column Sorted By Another Column

bogdanik
Regular Visitor

Have you found a decision?

There are dax function for it ORDERBY but i am not sure that it is the best solution 

How do you mean if I found a decision? I went with the accepted solution above.

Works like a charm

rpinxt
Solution Sage
Solution Sage

@v-yadongf-msft well yeah of course I can sort it manually but the whole purpose of using Power BI is to make data handling better, easier to use and visually better than manual work 😁.

Anyway thru several online post I came up with a solution myself for this problem.

First of you need to make an extera column in the parameter field table:

rpinxt_0-1666338755925.png

It is a copy of the main column in the table but for some reason you cannot use that one.

(getting error about the composite key etc)

 

When you have that you kan make a variable Rank Measure like:

rpinxt_1-1666339364388.png

And when you switch to USD view:

rpinxt_2-1666339430628.png

Works like a charm! 😁

 

And if you don't want to show the rank measure in your visual you can turn word wrap of in column header and the values and then you can just hide the column by sliding the width all to the left making it so narrow that it will nog show anymore.

For a chart even more easy, you just put it in the tooltips and then you can still sort on it but it won't show in the graph.

v-yadongf-msft
Community Support
Community Support

Hi @rpinxt ,

 

By default, as shown, the visual doesn't sort the field parameter. 

vyadongfmsft_0-1666337955209.png

You can sort field parameter manually.

 

Best regards,

Yadong Fang

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

v-yadongf-msft
Community Support
Community Support

Hi @rpinxt ,

 

The sorting of field parameter is the same as the sorting of common fields, which can be ascending or descending.

 

What problems are you having with sorting field parameters ? Can you explain it with some screenshots?

 

Best regards,

Yadong Fang

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

 

 

Hi @v-yadongf-msft 

 

I don't think sorting is the same. Because parameter fields change the visual (which they are intended to do).

Here are some examples :

rpinxt_0-1666333352880.png

 

So here you see the visual is sorted by BO Qty descending.

At the top you see I have a slicer with BO Qty and USD Amt which are parameter fields.

(set up with the new parameter function in Power BI)

 

Now I switch the view to dollars instead of quantities:

rpinxt_1-1666333485047.png

Now you can clearly see that the visual is not sorted anymore by anything.

Probably logical because BO Qty is not in the visual anymore.

 

I love the new feature with field parameters but this is a big downside still.

The visual should have the variable parameter name in as a sort option not the field name that is currently selected:

rpinxt_2-1666333757693.pngrpinxt_3-1666333766569.png

 

Is there a way around?

So make the visual sort on the selected measure?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.