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
Anonymous
Not applicable

Dynamic Decimal Places for a Measure

Hi Everyone,

I have a measure with a whole number result which can range from 0  to 2 million based on filter selection.
Is there an option in Power BI where I can control the decimal places displayed based on the value. When I keep the Decimal Places Option as Auto, The measure shows value like 1.00 and 1.42M. The decimal places ae OK in the latter,but really not needed in the former.
When I keep the Decimal Places to 0, it is shown up as 1 and 1M, In this case the latter loses some required information.


I am aware of the format function, but would like to know if there any other method so that measure can remain a Decimal/Whole Number and not a string.
Thanks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Create a measure to realize it,such as below:

 

 

Measure = IF(SELECTEDVALUE('Table (2)'[Decimal option])="Auto",FORMAT(CONCATENATE(MAX('Table'[Column1]),"M"),"fixed"),FORMAT(CONCATENATE(ROUND(MAX('Table'[Column1]),0),"M"),"general number"))

 

 

 And you will see:

Annotation 2020-07-08 141422.png

Annotation 2020-07-08 141503.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

Create a measure to realize it,such as below:

 

 

Measure = IF(SELECTEDVALUE('Table (2)'[Decimal option])="Auto",FORMAT(CONCATENATE(MAX('Table'[Column1]),"M"),"fixed"),FORMAT(CONCATENATE(ROUND(MAX('Table'[Column1]),0),"M"),"general number"))

 

 

 And you will see:

Annotation 2020-07-08 141422.png

Annotation 2020-07-08 141503.png

 

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
amitchandak
Super User
Super User

@Anonymous , There is a setting in data format for the number of the decimal place.

or refer to this

https://docs.microsoft.com/en-us/power-bi/desktop-custom-format-strings

harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Please check this solution.

 

 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dynamic-number-of-decimal-places-and-thousand-separator/m-p/1084444

 

Regards,

Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

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.