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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jeongkim
Post Prodigy
Post Prodigy

Value format as per parameter

Hi,

 

How can I dynamically change its format as per specific column? 

e.g.

If 'Unit' = [%] then decimal 2 such 99.99

If 'Unit' <> [%] then whole number such 99999

 

please help create measure. 

 

jeongkim_0-1752549909725.png

 

 

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @jeongkim 

Add a column that indicates the format string for each each row. Select the measure, go to Format and select Dynamic

danextian_0-1752550441652.png

The first row's format string would be 0.00%, while the second row would use the format #,0.00.

Note: You may need to divide your percentage values by 100. Otherwise, they could appear incorrectly — for example, 0000% or 9986% instead of the expected percentages.

 

Please refer to this blob - Create dynamic format strings for measures 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @jeongkim 

Add a column that indicates the format string for each each row. Select the measure, go to Format and select Dynamic

danextian_0-1752550441652.png

The first row's format string would be 0.00%, while the second row would use the format #,0.00.

Note: You may need to divide your percentage values by 100. Otherwise, they could appear incorrectly — for example, 0000% or 9986% instead of the expected percentages.

 

Please refer to this blob - Create dynamic format strings for measures 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

value is calcuated by measure  not from column values.
how can I add your method? 
 
KPI Value =
    switch (
        true() ,
        selectedvalue('PM Data - Append Report_Data'[unit]) = "[%]" , average ( 'PM Data - Append Report_Data'[Value] ) ,

        sum ( 'PM Data - Append Report_Data'[Value] )
)

danextian_0-1752552271770.png

 

This is still a column and you're trying to return different measures depending on the current row value. You either add a format string column to that table or create format strings purely in a DAX expression. 

IF (
    SELECTEDVALUE ( 'PM Data - Append Report_Data'[unit] ) = "[%]",
    "0.00%",
    "#,0"
)

Please go to the link in my initial reply.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors