This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I want to write a dax to calculate discount to apply based on slicer selection [product slicer].
Example when Chair and Sofa are purchases I would like to apply a 12% discount but single selection using selectedvalues works but applying condition on multiple values obtained from the slicer does not.
Solved! Go to Solution.
Hi, @han_rj
You can try the following methods.
Measure 2 =
VAR _selectedprod =
ALLSELECTED ( 'Table'[Product] )
VAR _IntersectCount =
COUNTROWS ( INTERSECT ( _selectedprod, { "Chair", "Sofa" } ) )
VAR _List1Count = COUNTROWS ( _selectedprod )
VAR _result =
IF( _IntersectCount =_List1Count && _List1Count > 1,12,
SWITCH (
TRUE (),
SELECTEDVALUE('Table'[Product]) = "Chair", 10,
SELECTEDVALUE('Table'[Product]) = "Sofa", 20,
SELECTEDVALUE('Table'[Product]) = "Table", 15,
20
))
RETURN
_resultIs this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @han_rj
You can try the following methods.
Measure:
Measure =
VAR _selectedprod =
ALLSELECTED ( 'Table'[Product] )
VAR _IntersectCount =
COUNTROWS ( INTERSECT ( _selectedprod, { "Chair", "Sofa" } ) )
VAR _List1Count = COUNTROWS ( _selectedprod )
VAR _result =
SWITCH (
TRUE (),
SELECTEDVALUE('Table'[Product]) = "Chair", 10,
SELECTEDVALUE('Table'[Product]) = "Sofa", 20,
SELECTEDVALUE('Table'[Product]) = "Table", 15,
_IntersectCount =_List1Count, 12, 20
)
RETURN
_resultIs this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous , Thank You for checking , The value should be 12 when chair and sofa is selected
Hi, @han_rj
You can try the following methods.
Measure 2 =
VAR _selectedprod =
ALLSELECTED ( 'Table'[Product] )
VAR _IntersectCount =
COUNTROWS ( INTERSECT ( _selectedprod, { "Chair", "Sofa" } ) )
VAR _List1Count = COUNTROWS ( _selectedprod )
VAR _result =
IF( _IntersectCount =_List1Count && _List1Count > 1,12,
SWITCH (
TRUE (),
SELECTEDVALUE('Table'[Product]) = "Chair", 10,
SELECTEDVALUE('Table'[Product]) = "Sofa", 20,
SELECTEDVALUE('Table'[Product]) = "Table", 15,
20
))
RETURN
_resultIs this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank You , this helped me
@han_rj Correct, SELECTEDVALUE returns BLANK if there is more than one row returned. You can just grab the values (DISTINCT) in the slicer and use the IN operator.
@Greg_Deckler , thank you for responding,Tried using distinct in a calculated table, I am missing something please can you correct me.
@han_rj Should be something like:
VAR __selected = DISTINCT('Table'[Product])
VAR __result = SWITCH( TRUE(), "Chair" IN __selected, 10, ...
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |