cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jwik2 Regular Visitor
Regular Visitor

Switch between different measures on graph formatting

I've have a clustered column chart and the following measure:

RevenueCash_Pct Switcher2 = SWITCH([Selection3],1,[Revenue],2,[Revenue_Cash])
 

that allows me to switch between a dollar view and percentage view with a slicer at the top of the page. However, whenever I try and format these, the graph doesn't show anything.

 

RevenueCash_Pct Switcher2 = SWITCH([Selection3],1,FORMAT([Revenue],"0.00%"),2,FORMAT([Revenue_Cash],"$0,000"))
image1.PNGimage2.PNG
3 REPLIES 3
yelsherif Member
Member

Re: Switch between different measures on graph formatting

The FORMAT function turns the value into text, so the chart cannot interpret the text in this case.

However, you can change the way the logic works.

You can first prepare 2 series to be used, one for the dollar value and another for the percentage, e.g.
A) myValue = if([Selection3] = 1,0,myTable[ValueToBeUsed]) then set the format from Modeling tab to currency > USD

B) myValue% = if([Selection3]=1,myTable[ValueToBeUsed],0) and keep it unformatted

 

In the chart series add series A as it is, and add series B as a percent from grand total

 

When you make a selection to Selection3, the logic of each measure will either show the value or return 0, so only one series will be shown.

 

You can adjust the percent format from modeling tab to set how many decimal points you want

Community Support Team
Community Support Team

Re: Switch between different measures on graph formatting

Hi @jwik2 ,

 

Here we can create two measures instead of a combined one to work around and format the two measures in the Modeling pane. One for percentage format and one for currency format.

 

doll = var sel = SELECTEDVALUE('Table'[Value])
var _sum = CALCULATE(SUM('Table'[Value]),ALL('Table'))
return
IF(sel=2,_sum,BLANK())
percent = var _min = CALCULATE(MIN('Table'[Value]),ALL('Table'))
var _max = CALCULATE(MAX('Table'[Value]),ALL('Table'))
var sel = SELECTEDVALUE('Table'[Value])
return
IF(sel=1,_min/_max,BLANK())

 

2.PNG

 

In your scenario, I thin you should create two measure like this.

 

RevenueCash_Pct Switcher1 = if([Selection3]=1,[Revenue],BLANK())
RevenueCash_Pct Switcher2 = IF (Selection3]=2,[Revenue_Cash],BLANK())

 

Also please find the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Support Team
Community Support Team

Re: Switch between different measures on graph formatting

Hi @jwik2 ,

 

Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.


Regards,
Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 352 members 3,396 guests
Please welcome our newest community members: