Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi All,
I have created field parameters and using them in my clustered bar chart for both x-axis and y-axis. On y axis I have taken dimensions related field parameters and on x-axis I have taken measures related field parameters.
My requirement here to sort my visual based on one measure and in ascending order. But when I change the options and go to other options(changing the parameters related to visual) then it is getting reset.
I have seen that the similar issue is posted in 2022.
Can we have solution for this?
@lbendlin
Solved! Go to Solution.
When you create field parameter it creates a table with hidden columns
You can view these in the view hidden menu
X measure parameters = {
("Quantity", NAMEOF('Dax'[Quantity]), 0),
("Value", NAMEOF('Dax'[Value]), 1),
("Freight", NAMEOF('Dax'[Freight]), 2)
}
The "order" column controls what sequence the field parameters appear in the slicers and headers.
We can capture and use this field to contol the sort sequence of your clustered bar chart.
Create measure.
Sorter =
VAR Xoption = SELECTEDVALUE('X measure parameters'[X measure parameters Order])
RETURN
SWITCH(Xoption,
0,[Quantity],
1,[Value],
2, [Freight]
)
The SELECTEDVALUE gets the selected "order" for the measure you picked on the slicer.
The SWITCH then gets the equivalent measure value
Add the Sorter to your your clustered bar chart as tootltip.
The click on three dots [...], Sort axis, Sorter, Descending
Change the measure to handle multiple selections if required, so it slected you prefered measure sort sequence.
Please click [accept solution] and thumbs up buttons to show your appreciation.
When you create field parameter it creates a table with hidden columns
You can view these in the view hidden menu
X measure parameters = {
("Quantity", NAMEOF('Dax'[Quantity]), 0),
("Value", NAMEOF('Dax'[Value]), 1),
("Freight", NAMEOF('Dax'[Freight]), 2)
}
The "order" column controls what sequence the field parameters appear in the slicers and headers.
We can capture and use this field to contol the sort sequence of your clustered bar chart.
Create measure.
Sorter =
VAR Xoption = SELECTEDVALUE('X measure parameters'[X measure parameters Order])
RETURN
SWITCH(Xoption,
0,[Quantity],
1,[Value],
2, [Freight]
)
The SELECTEDVALUE gets the selected "order" for the measure you picked on the slicer.
The SWITCH then gets the equivalent measure value
Add the Sorter to your your clustered bar chart as tootltip.
The click on three dots [...], Sort axis, Sorter, Descending
Change the measure to handle multiple selections if required, so it slected you prefered measure sort sequence.
Please click [accept solution] and thumbs up buttons to show your appreciation.
I did the same earlier, but somehow I missed the order sequence. It is working as I expected now. Thank you.
Hi @RamyaKrishna_61 ,
To address the issue of sorting a clustered bar chart in Power BI when using field parameters for both the x-axis and y-axis, you can create a dynamic sorting measure using DAX. This issue arises because field parameters change the underlying data in the visual, which can cause the sort order to reset when parameters are switched. The solution involves creating a DAX measure that dynamically determines the value to be used for sorting, based on the selected parameter. For example, you can use a SWITCH function in the measure to return the relevant measure's value depending on the active selection from the field parameter. Once the measure is created, it can be added to the visual without being displayed, and you can configure the chart to sort by this measure in ascending or descending order as needed. This ensures that the sort order adapts dynamically to changes in the selected field parameter. To further enhance the user experience, you can also provide an option for users to explicitly select a sorting preference through a slicer. By anchoring the sort logic to a consistent calculated measure, this approach resolves the issue and ensures the visual maintains the desired sort order regardless of parameter changes.
Best regards,
Can you give an example. I have created a field parameter with units and units YOY na dcreated a clustered col chart for this for each commodity(x axis is fixed). The parameter selection is resetting the sort order. Is there a way I can fix the sort order to Units YOY sort descending using a measure. I am new to PBI so still in learning phase.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
145 | |
79 | |
64 | |
52 | |
47 |
User | Count |
---|---|
216 | |
89 | |
76 | |
67 | |
60 |