cancel
Showing results for
Did you mean:
Helper II

## Trouble to compare columns from differents table

Hello,

I am a beginner and am learning on my own and I really appreciate all the great knowlegde and support here.

Well, i have the following tables:

Table A:

 Order Boxs 123456 12 518918 87 556959 20 787717 35

Table B

 Order Pending 123456 12 518918 87 556959 25 787717 36

All i wanna do is compare the columns Boxs and Peding, like:

If(Boxs = Pending, "ok", "nok")

But i i dont how to do it because its 2 columns in different tables.

Someone can help me?

File:

Notes:

Table A = Base CL 10052021

Order = PL

Boxs = QTDE_CXS

Table B = SAP (2)

Order = PL

Pending = Pendente Faturamento

1 ACCEPTED SOLUTION
Solution Sage

Hello @henriquemalone,

Please create a calculated column in Table A:

Pending PL =
VAR PendingOrders = LOOKUPVALUE('Sap (2)'[PL],'Sap (2)'[PL],'Base CL 10052021'[PL])
RETURN
IF(ISBLANK(PendingOrders), "nok", "ok")

I hope this works for you. Let me know if it doesn't.
Thanks.
5 REPLIES 5
Community Support

I agree with the solution given by @rajulshah  and tested it, and got the correct result:

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

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

Helper II

It didnt work for me because i need to compare my columns Boxs x Pending, like

if( Boxs = Pending, "ok", "nok")

Your dax is just creating a column in my table A with the Orders Number from table B

Community Support

There is no error in the written formula. You need to understand the lookupvalue function. Its function is to retrieve the values that meet all the matching conditions from the table (and the matching condition in the above formula is whether Boxs = Pending), and the if function determines the value that meets the conditions. It is "ok", otherwise it is "nok".

For the detailed usage of the formula, please refer to the official document.LOOKUPVALUE function (DAX) - DAX | Microsoft Docs

Best Regards,
Henry

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

Solution Sage

Hello @henriquemalone,

Please create a calculated column in Table A:

Pending PL =
VAR PendingOrders = LOOKUPVALUE('Sap (2)'[PL],'Sap (2)'[PL],'Base CL 10052021'[PL])
RETURN
IF(ISBLANK(PendingOrders), "nok", "ok")

I hope this works for you. Let me know if it doesn't.
Thanks.
Helper II

It didnt work for me because i need to compare my columns Boxs x Pending, like

if( Boxs = Pending, "ok", "nok")

Your dax is just creating a column in my table A with the Orders Number from table B

Announcements

#### Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.