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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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...

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...

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

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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