Forum Discussion

Matt_Gol's avatar
Matt_Gol
Helper I
4 years ago
Solved

How to multiply two columns from two different tables(Direct query)

Hi everyone I have a report in direct query. Consider I have 2 tables(table1 and table2) which both have a column that contains stock items. The relation is one to many. how can I calculate Table1...
  • amitchandak's avatar
    4 years ago

    Matt_Gol , As suggested by Luuky  Try SUMX with related. If there is 1-M relationship between Table 2 to table 1 it should work

     

    example

    Sumx(Table1, Table1[Qty]*related(Table2[Price]))

     

    if not then you might have do more work

     

    example

     

    Sumx(Table1, Table1[Qty]*Maxx(filter(Table2, Table[Item] = Table2[Item]) , Table2[Price]))

     

    you can more conditions in second one as per need