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

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

Reply
Nourhassan
Helper I
Helper I

If clause from two different tables

Hello,

 

I would like to filter a condition from table X and look if this record is also given in table Y.

 

Example

Table X:

TitleApproved
ABC-1Yes
ABC-2No 
ABC-3No

 

Table Y:

TitleApproved
ABC-4No 
ABC-5No

 

So I need to look if ABC-1 is Approved="Yes" but not containing in table Y and retrieve 0. 

I am not sure how to write it in DAX and need your help, please.

 

Thank you in advance.

 

 

 

 

3 REPLIES 3
Nourhassan
Helper I
Helper I

Hello,

Sorry for not being so clear. I had a mistake with my description, so here again what I want:

 

I have two tables and I want to check if a record from the first table with the conditions that FirstApproval=Yes and Advanced=Yes are recorded in the Vouchers table (the second table). If yes, then retrieve me 0, and if no, then give me the Amount of the record from the first table. The conditions are only given as columns in table 1.

 

Petty Cash (Table 1):

 

Reference IDFirstApprovalAdvancedAmount
20YesYes100
21YesNo110
22YesYes120

 

 

Vouchers (Table2):

TitleAmount
21110
22120

 

 

So here we can see that the record with Reference ID 20 and the required conditions is not listed in the Vouchers table. The new column should retrieve the amount of this record from the Petty Cash table (table 1).

 

I hope this is now more clear.

Thank you.  

ERD
Community Champion
Community Champion

Hi @Nourhassan ,

Do you need a new column in your Petty Cash table or a measure ?

In case of a column:

 

NewAmt column = 
IF(
    'T-Petty Cash'[FirstApproval] = "Yes" 
        && 'T-Petty Cash'[Advanced] = "Yes" 
        && 'T-Petty Cash'[Reference ID] IN VALUES('T-Vouchers'[Title]), 
    0, 
    'T-Petty Cash'[Amount]
)

 

In case of a measure:

 

#NewAmt measure = 
SUMX (
    VALUES ( 'T-Petty Cash'[Reference ID] ),
    CALCULATE (
        IF (
            MAX ( 'T-Petty Cash'[FirstApproval] ) = "Yes"
                && MAX ( 'T-Petty Cash'[Advanced] ) = "Yes"
                && MAX ( 'T-Petty Cash'[Reference ID] ) IN VALUES ( 'T-Vouchers'[Title] ),
            0,
            MAX ( 'T-Petty Cash'[Amount] )
        )
    )
)

 

ERD_0-1622736944381.png

 

If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

amitchandak
Super User
Super User

@Nourhassan , Not very clear.

But you need a new column like this in Table X


new column =
if(countx(filter(TableY, TableY[Title] = TableX[Title] && TableY[Approved] ="Yes"), TableY[Title]) +0>0, "Yes", "No")

 

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.