Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
hanwang
New 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, I see it automatically converted into $0.3T, -$0.3T and $0T. Is there any way can change the display to when it is a trillion, show billion and when it is billion show billion, when it is million show million, when is thounsand show k.

 

I tried to use the actual value in the bar and dynamic formatting as: 

SWITCH (
   TRUE(),
   ABS(v) >= 1e12, FORMAT( v/1e9, "$#,0.0") & "Bn", 
   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.0") & "K",
   FORMAT( v, "$#,0")
)

But it doesn't work when it has multiple bars.

 

Can someone share some ideas?

 

Thanks.

1 ACCEPTED SOLUTION
Cookistador
Super User
Super User

Hello @hanwang 

 

For me , the following approach works:

 

Cookistador_0-1757310640148.png

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
Cookistador_1-1757310810484.png

 

 
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

 

View solution in original post

1 REPLY 1
Cookistador
Super User
Super User

Hello @hanwang 

 

For me , the following approach works:

 

Cookistador_0-1757310640148.png

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
Cookistador_1-1757310810484.png

 

 
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

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors