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.
Hi,
I'm trying to have a bar chart with a dynamic x-axis based on a slicer selection. The users should be able to select % or # in a slicer and the result should either be shown in percentage or whole number. The issue that I'm facing is that I can't seem to be able to get the fomatting done correctly.
I've tried different expressions but they all seem to format the values as text. And it doesn't seem like I can have text as "Values" in a bar chart. It works fine in a table, but not in a bar chart.
[Package Conversion] and [Packages] seen below are two separate measures.
My expression is:
Packages Confirmed =
IF(
HASONEVALUE(MeasureSelection[Selection]),
SWITCH(
VALUES(MeasureSelection[Selection]),
"%",
FORMAT([Package Conversion],"Percent"),
"#",
FORMAT([Packages],"General number")
)
)
I've also tried with this expression as I saw in another post, but I didn't get it to work either.
Packages Confirmed =
SWITCH(
VALUES(MeasureSelection[Selection]),
"%",
FORMAT([Package Conversion],"0.00%;(0.00%);0"),
"#",
FORMAT([Packages],"0.00;(0.00);0")
)
Is this possible in Power BI? Or do I have to look into calculation groups in Tabular Editor?
Sincerely
Dash
Solved! Go to Solution.
Hi @PBI-Dash
This can be done using tabular editor and calculation groups.
Check the blog post below about how you can achieve this:
https://www.sqlbi.com/articles/controlling-format-strings-in-calculation-groups/
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @PBI-Dash
This can be done using tabular editor and calculation groups.
Check the blog post below about how you can achieve this:
https://www.sqlbi.com/articles/controlling-format-strings-in-calculation-groups/
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |