Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
I have revenue measure that includes dynamic formatting to provide variable outcomes (K, M, bn):
VAR salesMeasure = [Revenue]
return
SWITCH(TRUE(),
salesMeasure-1000000000000 && salesMeasure< -1000000000, "$#,,,.0bn",
salesMeasure-1000000000 && salesMeasure< -1000000, "$#,,.0M",
salesMeasure> -1000000 && salesMeasure< -1000,"$#,.0K",
salesMeasure<1000,"$0",
salesMeasure<1000000, "$#,.0K",
salesMeasure<1000000000, "$#,,.0M",
salesMeasure>=1000000000, "$#,,,.0bn")
However, when I add the meausre to the Y-axis of my stacked column chart, the outcomes aren't what I'd expect. Regardless if I choose "None" or "Auto" in Display units, nothing changes. There's a crazy weird mix of K, M, and bn depending on what's going on with my legend parameter selections.
Any thoughts? I fear I may have already found the answer to my question here: Solved: Dynamic Formatting for Y-axis is incorrect for sta... - Microsoft Fabric Community but wanted to check again since that post is over a year old. Thanks in advance for your time!
EDIT 20-Oct-2025: My concern with the labels in this post is the total labels, not the stacked values. Realized I was not clear on that point in the original post - apoloigies for the confusion.
Solved! Go to Solution.
Hi @MuppetyMe
This appears to be a limitation of using a dynamic format string. In the example below, the total should display as around 2M, but instead it shows 2000K. According to the formatting logic, this value should fall under the millions category. A workaround, as suggested by @Idrissshatila , is to use a custom label. Since the total label itself cannot have a custom label, you can disable it, convert the chart to a combo chart, make the line invisible, and then apply the same custom label there. The total label though works fine with table/matrix.
Here's the string I used.
VAR _v = ABS ( [Sales] ) -- replace with your measure
RETURN
SWITCH (
TRUE(),
_v = 0, "0",
_v < 1, "#.###", -- e.g. 0.123
_v < 10, "0.##", -- e.g. 1.2
_v < 100, "0.##", -- e.g. 12.3
_v < 1000, "0.##0", -- e.g. 123.45
_v < 1000000, "#,##0,.K", -- thousands → 1.2K
_v < 1000000000, "#,##0,,.##M", -- millions → 1.2M
_v < 1000000000000, "#,##0,,,.##Bn", -- billions → 1.2Bn
"#,###" -- fallback
)
Hi @MuppetyMe
Thank you for submitting your question to the Microsoft Fabric Community Forum, and thanks to @Idrissshatila and @danextian offering helpful suggestions.
Could you let us know if the suggested solution resolved your issue? If it's still pending, please let us know any further details so we can help.
Best regards,
Community Support Team
Hi @MuppetyMe
This appears to be a limitation of using a dynamic format string. In the example below, the total should display as around 2M, but instead it shows 2000K. According to the formatting logic, this value should fall under the millions category. A workaround, as suggested by @Idrissshatila , is to use a custom label. Since the total label itself cannot have a custom label, you can disable it, convert the chart to a combo chart, make the line invisible, and then apply the same custom label there. The total label though works fine with table/matrix.
Here's the string I used.
VAR _v = ABS ( [Sales] ) -- replace with your measure
RETURN
SWITCH (
TRUE(),
_v = 0, "0",
_v < 1, "#.###", -- e.g. 0.123
_v < 10, "0.##", -- e.g. 1.2
_v < 100, "0.##", -- e.g. 12.3
_v < 1000, "0.##0", -- e.g. 123.45
_v < 1000000, "#,##0,.K", -- thousands → 1.2K
_v < 1000000000, "#,##0,,.##M", -- millions → 1.2M
_v < 1000000000000, "#,##0,,,.##Bn", -- billions → 1.2Bn
"#,###" -- fallback
)
Hi @danextian and @Idrissshatila, thank you both for your replies and suggestions. While these do solve for the stacked values, I'm unforutnately still struggling to get the total labels to reflect the correct values in K, M, or bn. I've tried converting from a line and stacked column chart to a stacked column chart, but this did not work. My apologies that I was not clear on the totals being the main concern.
As mentioned in my previous post, the total label text cannot be customized using another measure. Instead, convert your chart to line and column, make the line invisible (100% transparency) and apply the custom label to the line. Make sure their x-axes are aligned.
Second time is the charm - couldn't get it to work yesterday, but gave it another go and this time I got it. Thank you.
Hello @MuppetyMe ,
so i'll provide you with a solution to apply step by step.
first remove the dynamic formatting.
just add the stacked chart with the revenue measure as you can see below i replicated the bar
then you create a New Measure as the following
Revenue (Formatted) =
VAR salesMeasure = [Revenue]
RETURN
SWITCH(
TRUE(),
salesMeasure >= 1000000000,
FORMAT(salesMeasure / 1000000000, "$0.0") & "bn",
salesMeasure >= 1000000,
FORMAT(salesMeasure / 1000000, "$0.0") & "M",
salesMeasure >= 1000,
FORMAT(salesMeasure / 1000, "$0") & "K",
salesMeasure <= -1000000000,
FORMAT(salesMeasure / 1000000000, "$0.0") & "bn",
salesMeasure <= -1000000,
FORMAT(salesMeasure / 1000000, "$0.0") & "M",
salesMeasure <= -1000,
FORMAT(salesMeasure / 1000, "$0") & "K",
FORMAT(salesMeasure, "$0")
)
the you go the to formatting of the visual => data labels => values and replace the revenue with the measure revenue formatted
Proud to be a Super User! | |
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!