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

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.

Reply
Anonymous
Not applicable

Card values with conditional decimals

I'm having issues with a few measures I've created where visually, they are not being formatted the way I want them to be. Given specific values calculated by the measures, I need them to show up as such:

 

Measure = 25000, Card shows "25K"

Measure = 25100, Card shows "25.1K"

Measure = 2000000, Card shows "2M"

Measure = 2100000, Card shows "2.1M"

 

Right now, this is what I have as a rounding and formatting mechanism within the measure:

 

IF([Measure]>1000000,FORMAT(round([Measure]/1000000,1),"$#.#M"),FORMAT(round([Measure]/1000,1),"$#.#K")))
 
The problem here is that if the total is 25000, the measure shows up as "25.K", or with the 2000000 total, "2.M", leaving the decimal there regardless of whether it's needed. Is there any fix for this at all, either in the formula within the measure or with the formatting of the card itself?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You could use the following formula:

Measure 2 =
VAR _countof0 =
    LEN ( [Measure] ) - LEN ( SUBSTITUTE ( [Measure], "0", "" ) )
RETURN
    IF (
        _countof0 <= 2,
        FORMAT ( ROUND ( [Measure] / 1000, 1 ), "$0.0" ) & "" & "K",
        IF (
            _countof0 > 2
                && _countof0 < 5,
            FORMAT ( ROUND ( [Measure] / 1000, 1 ), "$#" ) & "" & "K",
            IF (
                _countof0 = 5,
                FORMAT ( ROUND ( [Measure] / 1000000, 1 ), "$#.0" ) & "" & "M",
                IF (
                    _countof0 > 5
                        && _countof0 < 8,
                    FORMAT ( ROUND ( [Measure] / 1000000, 1 ), "$#" ) & "" & "M"
                )
            )
        )
    )

My output looks like this:

10.22.1.1.gif

 

Here is the pbix file.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

You could use the following formula:

Measure 2 =
VAR _countof0 =
    LEN ( [Measure] ) - LEN ( SUBSTITUTE ( [Measure], "0", "" ) )
RETURN
    IF (
        _countof0 <= 2,
        FORMAT ( ROUND ( [Measure] / 1000, 1 ), "$0.0" ) & "" & "K",
        IF (
            _countof0 > 2
                && _countof0 < 5,
            FORMAT ( ROUND ( [Measure] / 1000, 1 ), "$#" ) & "" & "K",
            IF (
                _countof0 = 5,
                FORMAT ( ROUND ( [Measure] / 1000000, 1 ), "$#.0" ) & "" & "M",
                IF (
                    _countof0 > 5
                        && _countof0 < 8,
                    FORMAT ( ROUND ( [Measure] / 1000000, 1 ), "$#" ) & "" & "M"
                )
            )
        )
    )

My output looks like this:

10.22.1.1.gif

 

Here is the pbix file.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Thank you, Evelyn!

MattAllington
Community Champion
Community Champion

Try turning off the auto formatting in the card. I don't remember where it is, I think it is on one of the top few format menus. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
Anonymous
Not applicable

I tried doing that and still had the same issue with the decimal point remaining. I would actually use the "Auto" feature, but they switch between none and two decimal places, not one, which is what I'm trying to accomplish.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.