我有以下SQL查询:
SELECT * FROM [table1]
INNER JOIN
(SELECT [table2].table1_id, [table4].table4_id, count(*)
FROM [table2]
INNER JOIN [table3]
ON [table2].table3_id = [table3].table3_id
INNER JOIN [table4]
ON [table4].table4_id = [table3].table4_id
GROUP BY [table2].table1_id) as <table5>
ON [table1].table1_id = <table5>.table1_id
我需要做同样的事情,但为了在Power BI中使用它而转换为DAX,我有点迷失了。 我需要按table1获取table4组中元素的数量。
目前我正在使用以下措施:
Measure =
CALCULATE (
SUMMARIZE (
( NATURALINNERJOIN ( table2; NATURALINNERJOIN ( table3; table4 ) ) );
"qty"; COUNT ( table2[table1_id] )
)
)
但我不能让它发挥作用。任何想法?
非常感谢!!