Forum Discussion
How do we call variables in DAX measure
- 5 years ago
Hi saivina2920 ,
Please try this.
EMPSTATUS = VAR variables = SELECTEDVALUE('EMP QUERY'[EMP_PLACE]) RETURN CALCULATE( DISTINCTCOUNT ( 'EMP QUERY'[EMP_NUMBER] ), FILTER( ALL('EMP QUERY'), 'EMP QUERY'[EMP_REMARKS] in { "GOOD", "EXCELLENT"} && 'EMP QUERY'[EMP_COUNTRY] = "INDIA" && 'EMP QUERY'[EMP_PLACE] = variables ) )Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Perfect. One last question.
How to exclude selected value like not in selected value in the measure.
VAR variables = SELECTEDVALUE('EMP QUERY'[EMP_PLACE])
if this NOT IN selected value, then my problem is solved.
You can leverage the NOT operator
NOT('EMP QUERY'[EMP_REMARKS]) IN { variables}
- saivina29205 years agoPost Prodigy
Thanks. But, not suppose to come for variables. not for column.
It should come like below. I am not sure whether it is correct or not. but, not in {Variables}
('EMP QUERY'[EMP_REMARKS]) NOT IN { variables} ==> Will it work....?
- NandanHegde5 years agoSuper User
Hey,
You can refer the below link:
https://community.powerbi.com/t5/Desktop/DAX-equivalent-of-SQL-s-NOT-IN/m-p/586184
This is the correct code:
NOT('EMP QUERY'[EMP_REMARKS]) IN { variables}
and not the NOT IN {variables}- saivina29205 years agoPost Prodigy
Thanks. got it. It's working and perfect.