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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Krishnan_47
Helper I
Helper I

Dynamically converting numbers and showing in donut or pie charts is returning blank

Hi All,

 

I am dynamically converting numbers in a measure into showing Millions or Thousands. If a number is large, we will show 'M' besides the number and if the number is small we will display 'K'. Please find below screenshot.

 

Krishnan_47_0-1652005872148.png

 

Now when I use this measure in a pie chart or donut, it shows as blank.

 

I would like to know if there is any other way to display dynamically converted numbers into pie chart or donut? I am trying for the ouput as shown below:

Krishnan_47_1-1652006103430.png

 

4 REPLIES 4
Anonymous
Not applicable

Hi @Krishnan_47 ,

 

You can set the display unit to be 'K' or 'M', but not both 'K' and 'M' in the same field.

vstephenmsft_0-1652250016434.png

 

 

Best Regards,

Stephen Tao

 

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

AlexisOlson
Super User
Super User

You can do something like this:

AlexisOlson_0-1652053587724.png

 

Or you can get a bit fancier and use logarithms.

FormattedMeasure = 
VAR _Value = [UnformattedMeasure]
VAR _Digits = IF ( ABS ( _Value ) < 1, 0, LOG10 ( ABS ( _Value ) ) )
VAR _Commas = ROUNDDOWN ( _Digits  / 3, 0 )
RETURN
    SWITCH (
        _Commas,
        0, FORMAT ( _Value, "0" ),
        1, FORMAT ( _Value, "0,k" ),
        2, FORMAT ( _Value, "0,,M" ),
        3, FORMAT ( _Value, "0,,,B" ),
        FORMAT ( _Value, "#,0,,,,T" )
    )

 

For more on the FORMAT function, see here (particularly the last couple of examples):
https://dax.guide/format/

Hi Alexis Olson,

 

Thank you for the reply. I need to use this measure inside a Pie Chart or a Donut. Currently it is displaying as blank.

That's because this outputs text but charts need numbers.

 

I think you can get around this using a format string expression as part of a calculation group.

https://www.sqlbi.com/articles/controlling-format-strings-in-calculation-groups/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.