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.
Hi saivina2920 ,
Please try the formula.
EMPSTATUS =
VAR variables = SELECTEDVALUE('EMP QUERY'[EMP_PLACE])
RETURN
CALCULATE(
DISTINCTCOUNT ( 'EMP QUERY'[EMP_NUMBER] ),
FILTER(
ALL('EMP QUERY'),
'EMP QUERY'[EMP_REMARKS] = "GOOD" &&
'EMP QUERY'[EMP_COUNTRY] = "INDIA" &&
'EMP QUERY'[EMP_PLACE] = variables
)
)
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- saivina29205 years agoPost Prodigy
Thanks again for your great help.
Shall i use the below condition if more than two values.
'EMP QUERY'[EMP_REMARKS] in ("GOOD","EXCELLENT")
- v-lionel-msft5 years agoCommunity Support
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.
- saivina29205 years agoPost Prodigy
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.
- NandanHegde5 years agoSuper User
Hey saivina2920
Sorry for the delayed response as I was on some medical leave.
The above answer provided by CST is accurate but for using IN operator you should use {} and not ()