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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
zouweyhd
Frequent Visitor

if else statement between 2 Tables

hello everyone

how can i build an if else colomn between to Tables that have a colomn in common ( which is the Invoice number )

and i cannot merge the 2 Tables because both are huge ( each contains about 400K lines and 40 column at least )

 

your help will be highly appreciated 

1 ACCEPTED SOLUTION

Hi @zouweyhd

 

RELATED is a DAX function. You should use it in a calculated column in data model rather than in a custom column in Power Query Editor.

22012504.jpg

In Data view, click New column and enter below code in the formula bar. 

Nettowert =
IF (
    RELATED ( 'table2'[VGTYP] ) IN { "H", "K", "N", "O" },
    [NETWR] * -1,
    [NETWR]
)

 

The RELATED function requires that a regular relationship exists between the current table and the table with related information. You need to create a relationship on the common column in advance. And ensure that each row has only one related "VGTYP" value in the other table. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@zouweyhd , You need to move column one table to another or compare them in measure using common dimensions 

 

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

zouweyhd_0-1642581841783.png

i have built this statement but im not sure if it will do 

Hi @zouweyhd

 

RELATED is a DAX function. You should use it in a calculated column in data model rather than in a custom column in Power Query Editor.

22012504.jpg

In Data view, click New column and enter below code in the formula bar. 

Nettowert =
IF (
    RELATED ( 'table2'[VGTYP] ) IN { "H", "K", "N", "O" },
    [NETWR] * -1,
    [NETWR]
)

 

The RELATED function requires that a regular relationship exists between the current table and the table with related information. You need to create a relationship on the common column in advance. And ensure that each row has only one related "VGTYP" value in the other table. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

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.

Top Kudoed Authors