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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

How to dynamically format numbers, currency and abbreviation ($K, $M, $B) in Detail Labels?

dynamic number formatting for visuals detail labels.png

My requires that I show numbers as  ## $K, and my data column for a chart has numbers in the thousands, millions and billions.

 

Chart visuals require numbers in order to show detail labels, but the only way I know to dynamically format numbers creates text that cannot be used as a label.

 

The Format pane options for Detail Labels gives an fx field for color, but not for Display Units or Decimal Places.

 

For example, I need the detail labels on this visual to show 1.25 $B with two decimals when equal to or above to a billion, and 820 $M without decimals when below a billion. I can handle the creation of formulas, but there doesn't seem to be a way to enter those formulas anywhere. Help!

1 ACCEPTED SOLUTION

Hi @Anonymous  I suggest that you follow my steps in order to ensure that you performed the same actions.
Also attached is an example I made.
1. 

Ritaf1983_0-1684289139553.png

2. Just calculate your measure as you need.

Ritaf1983_1-1684289297819.png

 

3. Modify your format changes based on this measure:

Ritaf1983_2-1684289382768.png

Dax code:

SWITCH(
    true(),
    SELECTEDMEASURE()>999999999,"$#,##0,,,.0B",
    SELECTEDMEASURE()>999999,"$#,##0,,.0M",
    SELECTEDMEASURE()>999,"$#,##0,.00K","$#,##0.0")

4. Put it on your chart and pay attention to that "display units" is "none" on format options of value:

Ritaf1983_3-1684289608362.png

 

Result :

Link to the sample file 

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

I got an updated powerbi version and am using the dynamic format to format string measures and it simply seems buggy.

I'm trying to format millions to a shortened format such as $8.9M but the output in the chart's detail labels is inconsistent (and wonky!);

 

Data               Desired result          Actual result
8,999,274         $8.9M                     $9.0M
13,156,240       $13.2M                   $132M
20,271,133       $20.3M                   $2202711333M


My Measure formula is:

Measure = MAX(table[column])

 

My format formula is:

VAR Tot = MAX('table'[column])
RETURN FORMAT(Tot/1000000, "$#,##0.0M")

{65656550-DD3F-4A49-B42D-06C145D34D2A}.png

Hi @Anonymous  I suggest that you follow my steps in order to ensure that you performed the same actions.
Also attached is an example I made.
1. 

Ritaf1983_0-1684289139553.png

2. Just calculate your measure as you need.

Ritaf1983_1-1684289297819.png

 

3. Modify your format changes based on this measure:

Ritaf1983_2-1684289382768.png

Dax code:

SWITCH(
    true(),
    SELECTEDMEASURE()>999999999,"$#,##0,,,.0B",
    SELECTEDMEASURE()>999999,"$#,##0,,.0M",
    SELECTEDMEASURE()>999,"$#,##0,.00K","$#,##0.0")

4. Put it on your chart and pay attention to that "display units" is "none" on format options of value:

Ritaf1983_3-1684289608362.png

 

Result :

Link to the sample file 

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Anonymous
Not applicable

Thank you @Ritaf1983 !
The article mentions this feature is available with PBI Desktop version 2.116.622.0 or later. I have requested this version to my employer and will report back as soon as I can try the solution.

Ritaf1983
Super User
Super User

Hi @Anonymous 
From the April version of the desktop, you have this option generically .

please refer to this tutorial:
https://datasavvy.me/2023/04/21/how-to-use-the-new-dynamic-format-strings-for-measures-in-power-bi/

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.


Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors