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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yjlee1212
Frequent Visitor

How do I show fixed number of digits on a card

Hello,

 

My client asked if the card can show 3 digits no matter what the numbers are.

For example, for the cards, the numbers are showing up with automatic unit display: 4M, 133K, 3000, 100, etc. 

The client asked if I can make the card always show 3 significant digits and I don't know how to do it.

He is expecting for 4M number in the card, it should show 4.XXM now but for 133K, it should stay the same without any decimal number. 

 

Is there a way for me to achieve what is being asked over here? 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @yjlee1212 ,

 

you can check the numbers and then return a different value with the FORMAT string.

A while ago I wrote a blog article how you can do a automatic scaling (give back as Billion, Million, Thousand or without any scaling):

Dynamic scaling of a measure in Power BI with DAX - What the fact.bi

 

The mechanism should be the same for you, something like this should work for you:

SUM Sales dynamic =
VAR _SumSales = SUM( FactInternetSales[SalesAmount] ) 
VAR _FormattedSales = SWITCH(
    TRUE(),
    _SumSales < 1000000, FORMAT( _SumSales, "000, K" ),
    _SumSales < 10000000, FORMAT( _SumSales, " 0 , , .00 Mil" ),
    _SumSales
) 

RETURN
_FormattedSales

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

View solution in original post

2 REPLIES 2
selimovd
Super User
Super User

Hey @yjlee1212 ,

 

you can check the numbers and then return a different value with the FORMAT string.

A while ago I wrote a blog article how you can do a automatic scaling (give back as Billion, Million, Thousand or without any scaling):

Dynamic scaling of a measure in Power BI with DAX - What the fact.bi

 

The mechanism should be the same for you, something like this should work for you:

SUM Sales dynamic =
VAR _SumSales = SUM( FactInternetSales[SalesAmount] ) 
VAR _FormattedSales = SWITCH(
    TRUE(),
    _SumSales < 1000000, FORMAT( _SumSales, "000, K" ),
    _SumSales < 10000000, FORMAT( _SumSales, " 0 , , .00 Mil" ),
    _SumSales
) 

RETURN
_FormattedSales

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

Hello @selimovd 

 

Thanks for showing me the solution. This was exactly what I needed. I made some minor addition to the logic and it works like a magic! I really appreciate it!.

 

Regards,

Yong-Jin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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