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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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