New to DAX, I'm trying to create a below DAX query, however, I'm not sure how to go about, I've a measure (selected value by user) using which I want to pass to the query, and using that measure I want to pass dynamic parameters to a filter. Below is what I want to achieve.
TABLE_SUM =
CALCULATE(SUM('TABLE'[Total]),
FILTER('TABLE',
'TABLE'[Filter_1] = [Selected-val-1] &&
'TABLE'[Filter_2] = "CONSTANT1" &&
'TABLE'[Filter_3] = "CONSTANT2" &&
'TABLE'[Filter_4] IN (IF ([Selected-val-2] =="All", DISTINCT('TABLE'[Filter_4]),[Selected-val-2])))
)
IF all
is selected then I want distinct values of 'TABLE'[Filter_4]
else I want to pass [Selected-val-2]
?
I get is not a valid table
error... if I remove If else condition and only apply the true condition inside IN
clause, I don't get the error, but it doesn't solve my purpose.
SELECTEDVALUE('TABLE2'[Filter_4],"All")
– Kid101