Forum Discussion
Anonymous
2 years agoNot applicable
Measure for query using IN statement
Hello, I need to write a measure to do the following query. SELECT count(*) FROM table 1 a WHERE a.code IN (select b.code from table 2 b where b.id = selectedvalue(table3[id]) Appreciate any...
- Anonymous2 years ago
Hi Anonymous
Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
aduguid
2 years agoMemorable Member
I tried to refactor the DAX
SelectedCount =
VAR SelectedID = SELECTEDVALUE(Table3[id])
RETURN
CALCULATE(
COUNTROWS(Table1),
FILTER(
Table1,
Table1[code] IN
CALCULATETABLE(
VALUES(Table2[code]),
Table2[id] = SelectedID
)
)
)Anonymous
2 years agoNot applicable
Thanks! I tried refactor measure and got nothing unfortunately...