Forum Discussion
Iaine
10 months agoFrequent Visitor
How to Sort Pie Chart Values When Using SSAS Measures?
I’m trying to configure a pie chart so that a specific value appears first. After searching online, it seems the usual approach is to use a custom table or add a column for sorting. Here’s the chal...
- 10 months ago
Iaine What does "first" mean in a pie chart? Like first on the Legend? That is simply a matter of your order of your measures in the Values field of the pie chart.
vivien57
Super User
10 months agoHello,
Without access to the SSAS model, it's difficult to do anything properly.
Can you create a local table in your Power BI ? If Yes, try this :
- Enable (if possible) the DirectQuery for Power BI datasets and AS feature and switch your report to a composite model (in Desktop: File → Options → Preview features if needed, then connect in DirectQuery to the compatible dataset/AS).
- Create a disconnected table (in Power BI Desktop):
MeasuresPie =
DATATABLE(
"Label", STRING,
"Order", INTEGER,
{
{"My Measure A", 1},
{"My Measure B", 2},
{"My Measure C", 3}
}
)
- Create a SWITCH measure that returns the SSAS measure based on the selected label:
Pie Value :=
VAR lbl = SELECTEDVALUE(MeasuresPie[Label])
RETURN
SWITCH(
TRUE(),
lbl = "My Measure A", [MeasureA_SSAS],
lbl = "My Measure B", [MeasureB_SSAS],
lbl = "My Measure C", [MeasureC_SSAS],
BLANK()
)
Have a nice day,
Vivien