cancel
Showing results for 
Search instead for 
Did you mean: 
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
Community Champion
Community Champion

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
Community Champion
Community Champion

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

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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors