Forum Discussion

shaebert's avatar
shaebert
Helper III
2 years ago
Solved

Merge Queries Help

Hello, I am looking for help in merging two tables. I don't know what join will achieve the following: 

 

 

 

  • You need an additional element to differenciate why the values of C are different. Otherwise both C values from table one will join to the C value of table two.

6 Replies

  • shaebert add the index column in both the tables, and then do the merge on Column1 and Index and that will do it.

     

    • shaebert's avatar
      shaebert
      Helper III

      The reason this doesn't work, is that the D and E won't match now.

  • CoreyP's avatar
    CoreyP
    Solution Sage

    You need an additional element to differenciate why the values of C are different. Otherwise both C values from table one will join to the C value of table two.

    • shaebert's avatar
      shaebert
      Helper III

      In my case, the C's are just different quantities. So I bought 2 C's in table one and sold 1 C in table two. I want to show that I still have one left over.

      • CoreyP's avatar
        CoreyP
        Solution Sage

        Hmmm. Maybe create a Product Dim table with all the unique values of your products ( A, B, C, D, etc. ). Create a relationship between table one ( Bought ) and table two ( sold ). Create a measure, Available Qty = SUM( table1[bought]) - SUM( table2[sold])

        ???

  • shaebert Yes, you are right, oversight on my end - not sure what your end goal is, maybe merge is not going to be the right approach, although it can be solved but still it would be nice to know the end goal.