The idea is to return true when i select multiple items from a filter. Here goes the sample dax which is working for single select but somehow not working for multiselect.
Variation 1
Measure_Multiselect
if(
SELECTEDVALUE(‘Sales’[Customer Group Code (Lookup)]) in {“VE”,“TZ”},TRUE(),FALSE()
)
Variation 2
Measure_Multiselect
if(
OR(SELECTEDVALUE(‘Sales’[Customer Group Code (Lookup)]) = “VE”,SELECTEDVALUE(‘Sales’[Customer Group Code (Lookup)]) =“TZ”),
TRUE(),FALSE()
)
Variation 3
Measure_Multiselect
if(
SELECTEDVALUE(‘Sales’[Customer Group Code (Lookup)]) = “VE”,True(),If(SELECTEDVALUE(‘Sales’[Customer Group Code (Lookup)]) =“TZ”,TRUE(),FALSE()
))
So, who is up for some dax exercise. Also, Is there any way we can harvest filter selections placed at page level?
I hope you have DAX Studio installed…if not you can find it here: https://daxstudio.org/
Connect to your model, right click on the table name and choose: Define Filter Dump Measure
Antriksh reply is very close to what i want to do. Somehow, I cannot use antriksh approach coz the measure i am trying to create is a conditional measure. I should have given the full calculation context in the first post itself.
The logic is:-
if a certain set of values are selected in a slicer than apply one kind of measure and if other set of values are applied then apply some other measure. The conditional measure i wrote is working fine when only one value is selected in the slicer but when more than 1 value is selected it is returning blank for obvious reasons as selectedvalue returns only one value else blank.
@AntrikshSharma The reason why your measure didn’t work because it fails to keep the filter context coming from other different dimensions due to use of calculate ( I am not 100% sure here).
here is the measure i have edited using @AntrikshSharma approach
Plan Unit Revenue (Conditional) =
SWITCH (
TRUE (),
CALCULATE (
COUNTROWS ( VALUES ( 'Sales'[Customer Group Code (Lookup)] ) ),
KEEPFILTERS ( 'Sales'[Customer Group Code (Lookup)] IN { "VE", "TZ" } )
) >= 2, [Plan Unit Revenue (SVL)],
SELECTEDVALUE ( 'Sales'[Group] ) = "VE", [Plan Unit Revenue (VE)]
)
@AntrikshSharma As i said in my initial post i am trying to check for 2 values checked/selected simultaneously for ‘Sales’[Customer Group Code (Lookup)] column used as slicer and when it do so i would like to use [Plan Unit Revenue (SVL)] measure.
In other part of switch i am checking for a value on a different column and accordingly using a different measure.
Further, Thanks for posting about the dumping measure tooltip however i am already using it and i must say it is a very useful piece of DAX code. I am also an avid follower of SQLBI guys.