Forum Discussion
How use Multiple filter in DAX
Hello,
I am looking to create a measure that takes into account the interactive filter. If I select a single value in the filter the result is OK, on the other hand if I select several values the result is bad.
The filter works well and I can only find the lines that contain DEEZER OPTION and ACCESSOIRES MAISON CONNECTEE (539) anywhere in the compil_Kpi field
On the other hand, if I take several values in filter 1 or 2 it is KO
For example line 1 doesn't contain OPTION DEEZER or OPTION ASSURANCE SECUTITE
Mesure = CALCULATE(
sum('Panier_kpi'[indicateur_panier]),
FILTER ( 'Panier_kpi',
AND(CONTAINSSTRING ('Panier_kpi'[compil_Kpi],SELECTEDVALUE('Filtre1'[LibActeSousKpi])) ,
CONTAINSSTRING ( 'Panier_kpi'[compil_Kpi], Selectedvalue ('Filtre 2'[LibActeSousKpi])
)
)
)
)
'Panier_kpi'[indicateur_panier] equal to 1 on each line
I think it needs to replace SELECTEDVALUE with something else but in the forums I haven't found it.
Can anyone help me ?
3 Replies
- amitchandak
Super User
IODA , these tables Filtre1 and Filtre 2 are not joined with table? I think they should not be in this case
do you need Or or AND
Mesure = CALCULATE(
sum('Panier_kpi'[indicateur_panier]),
FILTER ( 'Panier_kpi',
OR (CONTAINSSTRING ('Panier_kpi'[compil_Kpi],SELECTEDVALUE('Filtre1'[LibActeSousKpi])) ,
CONTAINSSTRING ( 'Panier_kpi'[compil_Kpi], Selectedvalue ('Filtre 2'[LibActeSousKpi])
)
)
)
)- IODARegular Visitor
It's impossible to joined the table Filtre 1 & 2 besause the condition isn't equal but CONTAINSSTRING. The filter 1 is ok but only with one value. I look for replace SELECTEDVALUE i nthe filter by something like "listevalue"
Also i need AND because i want the two conditions in the same time not the filter one or two.
- AnonymousNot applicable
Hi IODA ,
I tried use VALUES() function instead of using SELECTEDVALUE() function but it seems the CONTAINSTRING() function doesn't support for a list of values.
Best Regards,
Jay