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
saferguson
Regular Visitor

Filter to change value used in chart

Hi everyone,

 

I've build a chart which shows the sum of revenue by month. I'd like to build in a filter which toggles delivery charge on/off, so that the chart either shows revenue including or excluding delivery depending on what the user selects.

 

At the moment the data is structured by transactions, with one column for 'revenue' and 'delivery charge' in another. I've created a new column which sums the two and I essentially want the chart to switch from using 'revenue' as the value in the visual to 'revenue + delivery'. I could make duplicate the page and change the values used but wondered if there is a more sophisticated way of doing this? 

 

 

Also the delivery charge isn't a fixed amount and varies depending on product. 

 

Thanks!

Sarah

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @saferguson,

 

First, please create an extra table which contains one column whose values are "revenue including delivery" and "revenue excluding delivery". you should add this column into slicer so that users can choose what they want to view.

You could create below measure:

 

Measure1=Sum('Table'[revenue])

Measure2=Sum('Table'[revenue + delivery])

Measure3=IF(SELECTEDVALUE="revenue including delivery",[Measure2],[Measure1])

 

Add [Measure3] into your chart visual.

 

Regards,

Yuliana Gu

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

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @saferguson,

 

First, please create an extra table which contains one column whose values are "revenue including delivery" and "revenue excluding delivery". you should add this column into slicer so that users can choose what they want to view.

You could create below measure:

 

Measure1=Sum('Table'[revenue])

Measure2=Sum('Table'[revenue + delivery])

Measure3=IF(SELECTEDVALUE="revenue including delivery",[Measure2],[Measure1])

 

Add [Measure3] into your chart visual.

 

Regards,

Yuliana Gu

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

At work so I won't be able to provide screens or samples so I'm hoping my feedback helps you move forward a little bit.  Here's one way to do without getting into specifics. 

 

1. Goto Edit Queries and select the data table.

2. Select the Revenue, Delivery Change, Revenue + Delivery columns

3. Goto Transform and select Unpivot Columns

4. You'll have 3 rows for every row originally with the new columns: Attribute (Revenue, Delivery Change, etc) and Value.

5. Build the filter/slicer/visual level filter tied to the Attribute column.

6. Another thing you can do is represent all 3 by dropping the Attribute Column onto the Category.  Selecting the filter should remove / enable which series to display.  

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.