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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
LadyCat
Frequent Visitor

Getting ALLSELECTED and IN To Work Together?

Hi All, 

 

I am fairly new to Power Bi and have a DAX question about how to make ALLSELECTED and IN work together.

 

Basically, I have data that looks like this: 

 

Product Table

Product Code  Value

1A

1B

1C

1D

1E

2A

2B

2C

2D

2E

 

In Power Bi, I put this table in a matrix with a filter on the "1" category.

 

I would like to calculate a simulated value based on some stress parameter in a slicer but only for selected products from the "1" category. The end result should appear in an aggregate form (such as a card) on my visual.

 

I have a measure that computes the total product value for selected products and that uses "ALLSELECTED": Value Selected Products = CALCULATE([Total Product Value], ALLSELECTED(Product Table[Product Code])).

 

I also have a slicer with the following measure: Stressed Value Products = CALCULATE([Value Selected Products]*(1 - Stress Value Product)/100))

 

Based on this, the user should be able to select individual products from the "1" category (all or a few), apply the stress in the slicer and get the stressed values for the selected products.

 

To do this, I am trying to write something like the following in Power Bi but it doesn't work: Stressed Value Selected Products = CALCULATE([Total Product Value], ALLSELECTED(Product Table[Product Code]) IN {"1A", "1B", "1C", "1D", "1E"}) and returns an error message (incorrect syntax). 

 

Is there a way to make ALLSELECTED and IN work together?

 

Any help will be greatly appreciated.

 

Thank you

 

2 REPLIES 2
KeyurPatel14
Responsive Resident
Responsive Resident

Hi @LadyCat ,
I actually dont know what you want exactly but you can refer to the below measure if you want to work with ALLSELECTED and IN together.

Test = 
VAR selectedprodcode = ALLSELECTED(Product Table[Product Code])
RETURN

CALCULATE(

                    [Total Product Value],

                    FILTER(

                               Product Table,Product Table[Product Code] IN selectedprodcode 

                    ),
)

Hi,

 

Thanks, I'll try this. Do you think there is an easier way to do this?

 

Regards 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.