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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
allen_sap
New Member

how to compare two columns from two tables

Hello Everyone,

Learning Power BI. This might be probably simple case but i cant seem to get the asnwer

Table 1 

Shop OrderShop Order LinePartSO QTY
1969321194-044-P390S15
1969322194-044-P5102S3
1969323194-044-P538S26
1969324194-044-S130S8
1969325194-044-S211S44

 

Table  2

PartINV QTY
194-044-P390S   62
194-044-P5102S   51
194-044-P538S   36
194-044-S130S   14
194-044-S211S   30
194-044-S212S   64
194-044-S213S   66
194-044-S929S   67

 

Question: 

Calculate column "Availability Status".
Availability Status of each shop order line is determined by whether supply satisfies demand, i.e. Not available = "SO Qty" > "INV Qty".

If i do a simple IF - i get circualur dependency error.

 

Thanks everyone 

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

You can try

Availability Status =
var _invQty =
LOOKUPVALUE(Table2[INV QTY],Table2[Part],Table1[Part])
Return
IF(
    [SO QTY] > _invQty,
    "Not Available",
    "Available"
)
as a calculated column in table1




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
allen_sap
New Member

Thanks for the reply but having difficulty executing it 

jgeddes
Super User
Super User

You can try

Availability Status =
var _invQty =
LOOKUPVALUE(Table2[INV QTY],Table2[Part],Table1[Part])
Return
IF(
    [SO QTY] > _invQty,
    "Not Available",
    "Available"
)
as a calculated column in table1




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
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.