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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.