Forum Discussion
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
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.
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.
3 Replies
- amitchandakSuper 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- zouweyhdFrequent Visitor
i have built this statement but im not sure if it will do
- v-jingzhangCommunity Support
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.
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.