Forum Discussion
Check if unique values of filtered column is among those in a list
Suppose I have a column X with values [A, B, C, C, A], and a slicer based off of X. What is the dax expression for a measure M such that M is true if, and only if, the unique values of X filtered are among {A, B}? It is kind of like a selected value, but for more than one value.
More generally, how should I check if the unique values of a filtered column are among those in a given (finite) list?
Hi c_laurenti,
If I have correctly understood the logic, you could use a measure like this:
In plain text:
M = VAR SelectedValues = VALUES ( 'Table'[X] ) VAR Flag = EXCEPT ( SelectedValues, { "A", "B" } ) RETURN ISBLANK ( Flag ) && COUNTROWS ( SelectedValues ) > 0Best Regards,
Alexander
2 Replies
- barritownSolution Sage
Hi c_laurenti,
If I have correctly understood the logic, you could use a measure like this:
In plain text:
M = VAR SelectedValues = VALUES ( 'Table'[X] ) VAR Flag = EXCEPT ( SelectedValues, { "A", "B" } ) RETURN ISBLANK ( Flag ) && COUNTROWS ( SelectedValues ) > 0Best Regards,
Alexander
- AnonymousNot applicable
Hi c_laurenti
barritown nice method!And here's my solution.According to your describe, here are my test process
To achieve your goal, you can follow these steps:
Here are my test data
1.Create a measure by using DAX
ISALLAB = VAR SELECTEDVALUES = VALUES('Table'[X]) RETURN COUNTROWS(INTERSECT(SELECTEDVALUES,{"A","B"}))=COUNTROWS(SELECTEDVALUES)2.Create a card by using measure
3.Final output
In order for you to solve the problem faster, you can refer to the following documentation
How to Get Your Question Answered Quickly - Microsoft Fabric Community
Best Regards,
Albert He