Forum Discussion

RafaelAri's avatar
RafaelAri
Helper III
2 years ago
Solved

Merging 2 different tables

Hello experts,

Attached is an Excel file with an example of what I need:

I have 2 data tables,

1) A list of items quantities in different warehouses

2) A list of purchase orders of items, each item can have several PO's.

The requirement is to present in "Table" visual a list of items whose total quantity in warehouses is "0" and for each such item the total quantity available for it in procurement (if there is no procurement then "0").
Thank you very much for any help

WH's Inventory
WH NameItem No.Item Name Qty. in WH
WH1Item1Name10
WH2Item1Name110
WH1Item2Name25
WH2Item2Name20
WH3Item2Name21
WH1Item3Name30
WH1Item4Name40
WH1Item5Name50
WH2Item5Name50
WH1Item6Name62
WH2Item6Name67
WH3Item6Name60
WH1Item7Name70
WH1Item8Name80
WH2Item8Name80
    
PO's Balance
PO No.Item No.Item Name Qty. on Purchase
PO1Item1Name18
PO2Item1Name17
PO3Item2Name25
PO4Item4Name46
PO5Item4Name43
PO5Item6Name610
PO5Item8Name820
PO6Item8Name810
PO6Item9Name92
PO6Item10Name106
PO6Item11Name113
    
Visual Table
Item No.Item Name Qty. in WH's Qty. on Purchase
Item3Name300
Item4Name409
Item5Name500
Item7Name700
Item8Name8030
  • RafaelAri 

    You can create and Items table that will sit above Warehouse and PO and link to them both based on Item No.

    This is the DAX code for the new table.

    Items = 
    DISTINCT(
        UNION ( 
            SUMMARIZE('Warehouse Inventory','Warehouse Inventory'[Item No.],'Warehouse Inventory'[Item Name]),
            SUMMARIZE('PO Balance','PO Balance'[Item No.],'PO Balance'[Item Name])
        )
    )

    Then you link it to the other tables in the model:

    Then a couple of mesures to sum the amounts from Warehouse and PO.

    Qty. in WH's = SUM ( 'Warehouse Inventory'[Qty. in WH] )
    Qty. on Purchase = SUM ( 'PO Balance'[Qty. on Purchase] )

     

    Add the item number and name from the Items table and the meausres to get the counts then set the fitler on the table to [Qty. in WH's] = 0

    I have attached my sample file for you to look at.

     

2 Replies

  • RafaelAri 

    You can create and Items table that will sit above Warehouse and PO and link to them both based on Item No.

    This is the DAX code for the new table.

    Items = 
    DISTINCT(
        UNION ( 
            SUMMARIZE('Warehouse Inventory','Warehouse Inventory'[Item No.],'Warehouse Inventory'[Item Name]),
            SUMMARIZE('PO Balance','PO Balance'[Item No.],'PO Balance'[Item Name])
        )
    )

    Then you link it to the other tables in the model:

    Then a couple of mesures to sum the amounts from Warehouse and PO.

    Qty. in WH's = SUM ( 'Warehouse Inventory'[Qty. in WH] )
    Qty. on Purchase = SUM ( 'PO Balance'[Qty. on Purchase] )

     

    Add the item number and name from the Items table and the meausres to get the counts then set the fitler on the table to [Qty. in WH's] = 0

    I have attached my sample file for you to look at.