Forum Discussion

rashidanwar's avatar
rashidanwar
Advocate II
5 years ago
Solved

Append tables

Hi Everyone I have 2 tables. Table 1 contains emlpoyees' actual performance and; Table 2 contains employees' target perfprmance Table 1 looks like as follow Date               Name        Prod...
  • mahoneypat's avatar
    5 years ago

    There are at least two good ways you could do this.

     

    1. Merge your second table into the first using the first three columns, and then write measures like this

     

    Qty Sold - Actual = SUMX(Table, Table[Qty Sold] - Table[Qty Target])

     

    2. Add a custom column called "Type" (or whatever you want) with text values of "Sold" and "Target" in the two tables, and then append them (load only the appended table) and then write measures like

     

    Qty Sold - Actual =

    var soldqty = CALCULATE(SUM(Table[Qty]), Table[Type] = "Sold")

    var targetqty = CALCULATE(SUM(Table[Qty]), Table[Type] = "Target")

    return soldqty - targetqty

     

    Note in both cases, it is recommended to use measures instead of creating calculated columns.

     

    Pat

     

  • Fowmy's avatar
    5 years ago

    rashidanwar 

    So the following steps in Power Query:

    1. Duplicate the Sales Amount Column

    2. Rename the  Qty Sold     Sales Amount to something line  Qty Sold-Target and Sales Amount Target
    3. Select Table 1 and choose append as a new query