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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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