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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
santoshlearner2
Resolver I
Resolver I

Switch to display measure values as it is

Dear All,

Requesting your assistance, i have  a switch id, the issue is in some the values should be displayed in decimals while others it should be rounded up. But what is happening that the formatting takes common formating for both decimans and whole number. Please assist.

 

Kp = SWITCH([select_switch],
    1,  Returns%,  --- This should be in decimal,  
    2,  Cost% ,  --- This should be in decimal,  
    3,  ROUND (Amt,0),  This should a whole number, but it gives in two decimal
    4,   [Growth % , --- This should be in decimal,
    5 Profit, This should a whole number, but it gives in two decimal

In the formatting if i select whole number than all the values shows as whole number and if i select decimal then the whole value displays as a decimal.
 
Please assist.
 
Warm Regards
1 ACCEPTED SOLUTION
Kedar_Pande
Super User
Super User

@santoshlearner2 

 

Formatted Kp =
SWITCH([select_switch],
1, [Returns%],
2, [Cost%],
3, ROUND([Amt], 0),
4, [Growth%],
5, ROUND([Profit], 0)
)

 

Select measure → Modeling ribbon → Format → Dynamic

Add format string expression:


SWITCH([select_switch],
1, "0.00%",
2, "0.00%",
3, "0",
4, "0.00%",
5, "0"
)

 

If this answer helped, please click Kudos or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande

View solution in original post

4 REPLIES 4
Kedar_Pande
Super User
Super User

@santoshlearner2 

 

Formatted Kp =
SWITCH([select_switch],
1, [Returns%],
2, [Cost%],
3, ROUND([Amt], 0),
4, [Growth%],
5, ROUND([Profit], 0)
)

 

Select measure → Modeling ribbon → Format → Dynamic

Add format string expression:


SWITCH([select_switch],
1, "0.00%",
2, "0.00%",
3, "0",
4, "0.00%",
5, "0"
)

 

If this answer helped, please click Kudos or Accept as Solution.
-Kedar
LinkedIn: https://www.linkedin.com/in/kedar-pande

Hi

 

Thank you very much, worked perfectly

MFelix
Super User
Super User

Hi @santoshlearner2 ,

 

You can use two solutions field parameters where you may add all your measures and they get the default formatting automatically, or using dynamic formatting string for this measure.

 

Check the documentation for both option below, in my opinion best option is Field parameter because if you want to make changes you just need to make it on the original measures:

 

https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters

https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-dynamic-format-strings


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



amitchandak
Super User
Super User

@santoshlearner2 , Use field paramaters or calculation groups or Dynamic String formatting 
A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f

Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0

Dynamic String formatting 
https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-dynamic-format-strings

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors