Forum Discussion

pang22's avatar
pang22
Icon for Helper III rankHelper III
2 years ago
Solved

Create new table using DAX from 2 tables with different number columns

  Hello,   I have 2 tables (Table 1 with 6 columns & Table 2 with 5 columns) loaded in PowerBI desktop. How to write a DAX to create a new table to sum the qty by month, factory, area and typ...
  • DimaMD's avatar
    2 years ago

    hi pang22  is this your desired outcome? Maybe I specified the sequence of columns incorrectly, but the concept of joining two tables is as follows

     

     

    t1ANDt2 = 
    VAR t1 = SUMMARIZE('Table 1','Table 1'[Loading month],'Table 1'[Type],'Table 1'[Factory],'Table 1'[Area],"qty", SUM('Table 1'[Order Qty]))
    var t2 = SUMMARIZE('Table 2','Table 2'[Year&Month],'Table 2'[Type],'Table 2'[Suggested Factory],'Table 2'[Area], "qty", SUM('Table 2'[Balance Qty]))
    VAR t3 = UNION(t1,t2)
    return
    t3