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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MCacc
Helper III
Helper III

Show percentage format in a measure with switch

Hello guys, I'm having problems to show the right format in a measure with switch.

 

From a filter, I have to choose if to show my measure as a sum or as a percentage.

 

this is the measure I've created:

Selection = var selection = SELECTEDVALUE('Switch'[ID]) return Switch(TRUE();selection = 2; [sum]; selection = 1; [division])

where Switch is a table I have created to make my selection in a filter


This table is made by two columns:
Selection               - ID
---------------------
Sum                       - 2
Percentage            - 1

 

So, if a click on Sum the measure [sum] should be shown. Otherwise, the measure [division]

Both measures have been formatted individually--> [sum] as a decimal number and [division] as a percentage (so, two 0s after the comma and % symbol in my example)

ISSUE: the format for the measure [division] doesn't work!!

 

I tried FORMAT([divsion]; "#0,00%") but it doesn't work since FORMAT returns a text and it cannot be used in a line chart, which is my final goal.

Any ideas? I hope my explanation was clear.

 

Thank you so much!

6 REPLIES 6
NikhilPandhare
Regular Visitor

If you are having measure multiply it with *100 and use card visual to display the percentage symbol

= (A/B)*100

then use card visual to display the percentage symbol

 

v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try divide measure like this:

Divide = FORMAT([division],"Percent")

Hope this helps.

 

Best Regards,

Giotto

nandukrishnavs
Super User
Super User

@MCacc -

I think your ask is very much similar to the Calculation Groups in Azure Analysis Service. Click here 
Unfortunately, we cannot define calculation groups in Power BI. This requirement is already listed in the ideas sections. You can vote.  https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/37146049-support-creating-calcula... 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Greg_Deckler
Super User
Super User

Right, this has come up a few times recently and not sure there is always an answer for how to accomplish it. You have specified the format for your other two measures, but the third measure also has a specified format so that is the one that takes precedence and you cannot flip between different formats in a single measure other than using FORMAT. You might take a look at CONVERT.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you very much for your suggestion. Unfortunately, CONVERT doesn't work either. I guess I'll have to find another way to work around it 🙂

Hi,

 

I think you can easily define one single measure custom fotmat in Model pane.

But in this case, it is impossible to define two different custom formats for one single measure based on slicer selected but only by format function. And format function will convert data to text which you do not want.

You can create an idea here:

https://ideas.powerbi.com/forums/265200-power-bi-ideas 

 

Best Regards,

Giotto

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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