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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
ZHelbert2277
New Member

Formatting within a switch measure as a percentage on a bar chart

I have the below measure being used to allow a user to change the metric being displayed on a bar chart. I cannot get any type of conditional formatting to work on the index 1 and defaul values that allow them to be displayed as a percentage. How can I accomplish this? I tried wrapping this 

 

COUNT('Complete Results'[Recipient Email]) / CALCULATE (COUNT('Complete Results'[Recipient Email]),ALLSELECTED())*100

 

in Format(Value,"Percent") and some otehr things I found on the forums, but none of them seemed to work. 

 

Any help is appreciated.

 

According to this post it is not supported https://community.powerbi.com/t5/Desktop/Creating-a-dynamic-chart-with-formats-Number-and-Percentage...

 

Are there any workarounds or another way I can accomplish teh same results?

 

Selected Metric =
SWITCH(
            TRUE(),
SELECTEDVALUE( 'Metric Selector'[Index] ) = 1, COUNT('Complete Results'[Recipient Email]) / CALCULATE (COUNT('Complete Results'[Recipient Email]),ALLSELECTED())*100,
SELECTEDVALUE( 'Metric Selector'[Index] ) = 2, IFERROR((IFERROR([Low Proj],0) + IFERROR([High Proj],0))/2,0)*-1,
SELECTEDVALUE( 'Metric Selector'[Index] ) = 3, -1*CALCULATE(ROUND(SUM('Complete Results'[Company_Change_in_Revenue]),2)),
COUNT('Complete Results'[Recipient Email]) / CALCULATE (COUNT('Complete Results'[Recipient Email]),ALLSELECTED())*100)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ZHelbert2277 , Create measure like this

COUNT('Complete Results'[Recipient Email]) / CALCULATE (COUNT('Complete Results'[Recipient Email]),ALLSELECTED())

 

From measure tool , option you will see once have measure selected in fields pane. You can mark it as % (There is a symbol)

 

refer here

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-measures#organizing-your-measures

 

Second, if you are using a measure slicer prefer field parameters or calculation groups

 

https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ZHelbert2277 , Create measure like this

COUNT('Complete Results'[Recipient Email]) / CALCULATE (COUNT('Complete Results'[Recipient Email]),ALLSELECTED())

 

From measure tool , option you will see once have measure selected in fields pane. You can mark it as % (There is a symbol)

 

refer here

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-measures#organizing-your-measures

 

Second, if you are using a measure slicer prefer field parameters or calculation groups

 

https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I will try this and see if it works, thank you!

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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