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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
horza
Frequent Visitor

using SELECTEDVALUE and SWITCH to choose multiple measures or columns

I'm fairly new to PowerBI. I've got to grips with using SELECTEDVALUE and SWITCH to accomplish a slicer that picks a measure to show in a single visualisation - in my case a clustered bar chart. I want the choice in the slicer to pick a set of measures to show in the clustered bar chart.

Imagine the slicer is selecting for an geographical area and in the bar chart I want to show a balance, incomings and outgoings for that area.


The code I have for the measure so far is below.. can I return some kind of collection??


WhichSalesArea =
var MySelection = SELECTEDVALUE('Measure Selection'[Measure Name], "Sales")
return SWITCH(TRUE(),
MySelection="Area1",[Area1],
MySelection="Area2",[Area2],
MySelection="Area3",[Area3],
MySelection
)

6 REPLIES 6
forgetmenot
Helper I
Helper I

@horza Did you find solution do this?

 

I'm having same issues Ic an use parameters in Bi to switch between 1 measure at time on chart, however i want to compare 2 measures at a time (so actuals Vs forecast) per category.

Does anyone know hot to achive this without having to create 4 charts/show hie with bookmarks?


amitchandak
Super User
Super User

Thanks for the links! The 'Guy in a cube' one is particularly interesting. However I can't apply that to the problem at hand.

The first two links are relevant but they only instruct on how to do the basic task of selecting one measure/column in the slicer. I can do that just fine. The problem is how to select multiple measures/columns.

To be more specific: Lets say I have a slicer where I can pick America, Asia and Europe. If I pick America I see a clustered chart where I can see three columns per time period e.g. balance, incomings, outgoings. I can pick Asia and see the balance, incomings and outgoings for each period in Asia... and Europe. The data for America, Asia and Europe is in 3 different tables. The balance, incomings and outgoings are in 3 different columns.

If the data for the 3 geographical areas is at the same granularity, why not make things easier by combining in one fact table?

Can you elaborate or provide an example?

Hi @horza ,

 

Can you  share some sample data in text format.

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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