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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Two Tbl combine IF statement - DAX

Hi Team,

 

I have two table and created relationship both ID's and trying DAX if statement , can you help me.

 

formula is = if (table 1 .ID=Table 2.ID ,(A/C)*(G*B),null)

 

Capture.PNG

Thanks,

KV's

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @Anonymous ,


According to your description, you could create new table and measure then change ralationship, the following formula to create a measure and table :
step 1: Add table(newTable)

 

NewTable =
var _Table1=SELECTCOLUMNS('Table1',"ID",[ID])
var _Table2=SELECTCOLUMNS('Table2',"ID",[ID])
return DISTINCT UNION(_Table1,_Table2)

 

step2:Add measure(The null returned by this measure is text format. If you want to change to number format, change "null" to blank()  )

value =
VAR _a =
    DIVIDE ( MAX ( 'Table1'[A] ), MAX ( 'Table1'[C] ) ) * SUM ( Table2[G] )
        * SUM ( Table1[B] )
RETURN
    IF ( MAX ( 'Table1'[ID] ) = MAX ( 'Table2'[ID] ), _a, "null" )

 

 

Step3:Change relationship

v-yalanwu-msft_0-1618470045063.png

The final output is shown below:

Two Tbl combine.png

Best Regards,
Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi @Anonymous ,


According to your description, you could create new table and measure then change ralationship, the following formula to create a measure and table :
step 1: Add table(newTable)

 

NewTable =
var _Table1=SELECTCOLUMNS('Table1',"ID",[ID])
var _Table2=SELECTCOLUMNS('Table2',"ID",[ID])
return DISTINCT UNION(_Table1,_Table2)

 

step2:Add measure(The null returned by this measure is text format. If you want to change to number format, change "null" to blank()  )

value =
VAR _a =
    DIVIDE ( MAX ( 'Table1'[A] ), MAX ( 'Table1'[C] ) ) * SUM ( Table2[G] )
        * SUM ( Table1[B] )
RETURN
    IF ( MAX ( 'Table1'[ID] ) = MAX ( 'Table2'[ID] ), _a, "null" )

 

 

Step3:Change relationship

v-yalanwu-msft_0-1618470045063.png

The final output is shown below:

Two Tbl combine.png

Best Regards,
Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , New column in Table 1

 

divide(Table1[A] , Table1[C])*(sumx(filter(Table2, Table2[ID]= Table1[ID]), Table2[G]) *Table1[B])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors