Forum Discussion
hanwang
11 months agoNew Member
Dynamic formatting on bar charts
Hi, I am facing an issue on bar charts. I have 3 bars would like to show on the bar chart. One of them is in $300 billion, one of them is in -$300 billion and one in $80 million. In the bar chart, ...
- 11 months ago
Hello hanwang
For me , the following approach works:
Value Formatted =VAR v = SUM('Table'[Value])RETURNSWITCH (TRUE(),ABS(v) >= 1e9, FORMAT( v / 1e9, "$#,0.0 Bn" ),ABS(v) >= 1e6, FORMAT( v / 1e6, "$#,0.0 M" ),ABS(v) >= 1e3, FORMAT( v / 1e3, "$#,0 K" ),FORMAT( v, "$#,0" ))And then in Format your visual in data label and values, I replaced the standard one by the measureIf it is not working, can you share more details like the look and fields you would like at the endTo achieve that, I created the following measure
Cookistador
11 months agoSuper User
Hello hanwang
For me , the following approach works:
Value Formatted =
VAR v = SUM('Table'[Value])
RETURN
SWITCH (
TRUE(),
ABS(v) >= 1e9, FORMAT( v / 1e9, "$#,0.0 Bn" ),
ABS(v) >= 1e6, FORMAT( v / 1e6, "$#,0.0 M" ),
ABS(v) >= 1e3, FORMAT( v / 1e3, "$#,0 K" ),
FORMAT( v, "$#,0" )
)
And then in Format your visual in data label and values, I replaced the standard one by the measure
If it is not working, can you share more details like the look and fields you would like at the end
To achieve that, I created the following measure