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

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.