Forum Discussion

rainchong7401's avatar
rainchong7401
Helper III
3 years ago

Find Matching from Multiple Relationship Table

Hi Guys,
I'm new to Power BI
I hope anyone of you could help me out. 

Table 1 is my item ordered quantity.
Table 2 is my transaction table which need to make sure quantity is received correctly to tally with Table 1 quantity.

Just want to ask you guys it is possible.
Expected output:
I want to sum received quantity (table 2) and match table 1 , SO-1, Item 1, quantity 230  
If table 2 sum of received quantity 230 based on item 1 match table 1 qty 230 
Return the MAX DATE of Partial delivery date 1/3/2022 in Table 1. 

It's complicated I hope someone can advise and provide code if you know. 

 

3 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi rainchong7401 
    I guess the two tables are related one-many? If so please use

    Partial delivery =
    VAR RelatedTable2 =
        RELATEDTABLE ( Table2 )
    RETURN
        IF (
            SUMX ( RelatedTable2, Table2[Received Quantity] ) = Table1[Received Quantity],
            MAXX ( RelatedTable2, Table2[Partial delivery date] )
        )