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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
keyway
Frequent Visitor

Multi selection in a SWITCH(TRUE()

Hi

 

I have the followed measure

 

Selected Item = 
VAR Selection = SELECTEDVALUE(Cost_Item,[Attribute],"All"

RETURN

SWITCH(
TRUE(),

Selection = "Salary", [Salary],

Selection = "Taxes",[Taxes],

Selection = "Commission",[Commision],

BLANK()

)

 

But i want to select more than one attribute and sum them:

I've tried

Selection IN ("Salary","Taxes"), [Taxes]+[Salary]

But that doesnt work

 

Any Help?

 

Thank you

 
 
 
1 ACCEPTED SOLUTION

Hi @keyway ,

 

Yes something similar to that.

 

Can you share a small sample of data and how you are calculating the taxes, and other measures?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

10 REPLIES 10
MFelix
Super User
Super User

Hi @keyway ,

 

Looking at your expression I'm assuming that you have an attribute column with (Salary, Taxes and Comission) and some measures with Salary, Taxes and Comission correct?

 

If you just make the Salary + Taxes + Comissions using a slicer should give expected result since the calculation of each measure will only be made if you select the value.

 

If this is not expected result can you share a sample of you data and expected value please.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



keyway
Frequent Visitor

 

You mean something like this Selection = "Taxes",[Taxes]+0 ?

Hi @keyway ,

 

We use the dax similar to the following to capture the multiple values from slicer:

 

Selecetvalues = values(table[slicer])

 

Would you please inform us more detailed information( your sample data(by OneDrive for Business)) if possible? Then we will help you more correctly.

 

Please don't contain any Confidential Information or Real data in your reply or files.

 

Best Regards,

Dedmon Dai

Hi @keyway ,

 

Yes something similar to that.

 

Can you share a small sample of data and how you are calculating the taxes, and other measures?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



keyway
Frequent Visitor

Hi Miguel

 

Your assumptions are correct:

If i select more than one item using a slicer the result is always a blank value, if i select one single item from the slicer i get the correct value.

Hi @keyway ,

 

Try to add a +0 to the measure you have.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



amitchandak
Super User
Super User

Try like

Selection IN {"Salary","Taxes"}, [Taxes]+[Salary]

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi

 

Yes, in fact that is the syntax i have on the code, i just missplaced the brakets on the message.

It shows a blank result

 

Thank you

 

SH-4
Frequent Visitor

Was this ever actually resolved? I've tried Selection IN {a, b, c} = a + b + c and it does not work.

I can only get my switch statement to work with single selection, but I need to be able to factor in for multiple selections and can't seem to find a solution if this is possible.

Hi @SH-4 ,

 

Can you please share some more detials on your requeriments?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors