rahul
rahul

Reputation: 21

DAX query to fill out a column based on a certain condition

I have two tables T1 (id,c1) and T2(id,a,b). I want to fill in values(0,1) for "c1" in T1.

Condition: If 'id' is present in T2 then fill row for 'c1' as '1' else '0'

What should be the DAX query for this?

Upvotes: 0

Views: 1206

Answers (1)

alejandro zuleta
alejandro zuleta

Reputation: 14118

Use the below expression for the c1 calculated column in the T1 table:

c1 = IF ( SUMX ( FILTER ( T2, [id] = EARLIER ( T1[id] ) ), 1 ) > 0, 1, 0 )

Upvotes: 1

Related Questions