Forum Discussion

OECvargoj's avatar
OECvargoj
Frequent Visitor
8 years ago

Matching based on conditions

Hello,

 

I'm trying to display matching part numbers based on them having an opposite Stock Status. Using the example data below, I need a way to match Company A with Company B based on them both having Part Number 123ABC in their inventory while at the same time having opposite Stock Status.

 

CompanyPart NumberStock Status
A123ABCStock
B123ABCNo Stock
C456ABCNo Stock
D456ABCStock
E789XYZStock
F789XYZNo Stock
G741QWEStock
H741QWENo Stock

 

Does anyone have a solution for this?

5 Replies

  • BraneyBI's avatar
    BraneyBI
    Kudo Commander

    Assume the table is called "Table1", add a calculated COLUMN which will show the reciprocal company.

     

    =CALCULATE( VALUES('Table1'[Company]),FILTER(ALL('Table1'),Table1[Part Number] = EARLIER(Table1[Part Number])&&Table1[Stock Status]<>EARLIER(Table1[Stock Status])))

     

     

    • OECvargoj's avatar
      OECvargoj
      Frequent Visitor

      Thank you BraneyBI! The calculated column is working however, when I add more than 2 companies to my dataset, I get an error message. Is there any way to modify the calculated column to account for more companies and possibly more than one match?