cancel
Showing results for
Did you mean:
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"))
3 REPLIES 3
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

## 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())```

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

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

Announcements

#### Challenge: Can You Solve These?

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

#### Community News & Announcements

Get your latest community news and announcements.

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

#### Win Power BI Swag with Community Kudopalooza!

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

Top Kudoed Authors
Users Online
Currently online: 352 members 3,396 guests
Recent signins: