Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dax for multiple inner self joins

Hi guys,

I need small help in writing DAX for below situation.

table_A
id date stagetype statustype
1042268 2020-01-27 1 1
1042268 2020-01-27 3 2
1041658 2020-01-27 2 2
1017296 2020-01-27 3 15
1042269 2020-01-27 1 1
1042270 2020-01-27 1 1
1041053 2020-01-27 3 2
1030893 2020-01-27 2 2
1030893 2020-01-27 3 2
1042271 2020-01-28 1 1

The SQL query is
select Count(DISTINCT R.id) AS 'ID'
FROM table_A R WITH(nolock)
INNER JOIN (SELECT DISTINCT SS.id,
Min(SS.date) AS MinDate
FROM table_A SS WITH(nolock)
WHERE SS.id IN (SELECT SSS.id
FROM table_A SSS WITH(nolock)
WHERE SSS.stagetype = 5
AND SSS.statustype = 4)
AND SS.statustype = 13
AND SS.stagetype = 5
GROUP BY SS.id) AS MinDate
ON R.id = MinDate.id
AND MinDate.mindate = R.date
WHERE R.id IN (SELECT DISTINCT SS.id
FROM Table_A SS WITH(nolock)
WHERE SS.id IN
(SELECT SSS.id FROM
Table_A SSS WITH (nolock)
WHERE SSS.stagetype = 5
AND SSS.statustype = 4 )
AND SS.statustype = 13
AND SS.stagetype = 5)

Actually the query using inner self join. I need DAX for above query. Please help on this.

0 REPLIES 0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.