Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
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 help/suggestions, Thank you!
Solved! Go to Solution.
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.
Try this measure out
SelectedCount =
VAR SelectedID = SELECTEDVALUE(Table3[id])
VAR FilteredCodes =
CALCULATETABLE(
VALUES(Table2[code]),
Table2[id] = SelectedID
)
RETURN
CALCULATE(
COUNTROWS(Table1),
Table1[code] IN FilteredCodes
)
Thanks for a quick respond! When tried your solution it took loong time and got a message "Couldn't load the data for this visual". Table1 has more than 10 mln records and I have filters for visuals on the page. May be I need to add filters to the measure also? If you can add to your solution for table1 source_id = 1 and service_id = 2 ? Many thanks!
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
)
)
)
Thanks! I tried refactor measure and got nothing unfortunately...
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.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 4 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 10 | |
| 8 | |
| 7 | |
| 6 |