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!
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.
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 🙂
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:
We're excited to announce our first cross-community 'Can You Solve These?' challenge!
Visit our Community Blog for articles, guides, and information created by fellow community members.
Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.