cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
henriquemalone
Helper II
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:

OrderBoxs
12345612
51891887
55695920
78771735

 

Table B

OrderPending
12345612
51891887
55695925
78771736

 

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:

https://drive.google.com/drive/folders/1HcMUlF0eddyPO6LA6XLgRR_mSwlsonSA?usp=sharing

 

Notes:

Table A = Base CL 10052021

Order = PL

Boxs = QTDE_CXS

 

Table B = SAP (2)

Order = PL

Pending = Pendente Faturamento

1 ACCEPTED SOLUTION
rajulshah
Solution Sage
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.

View solution in original post

5 REPLIES 5
v-henryk-mstf
Community Support
Community Support

Hi @henriquemalone ,

 

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

v-henryk-mstf_0-1621242822551.png


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.

Hi @v-henryk-mstf 

 

Hi @rajulshah 

 

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

Hi @henriquemalone ,

 

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.

rajulshah
Solution Sage
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.

View solution in original post

Hi @rajulshah 

 

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

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

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

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors