Forum Discussion

Mani_ms's avatar
Mani_ms
Icon for Helper I rankHelper I
6 years ago
Solved

Subtract measure category from two different table

Hi, I have two table one has master data(table 1) with sum measure and another one i have few category i want to subtract table 2 values by category.   Two table has common value has company code ...
  • MFelix's avatar
    6 years ago

    Hi Mani_ms ,

     

    Believe that the best option is to create a dimension table with unique values that allow to relate both companies at the sub category without the many to many category but with one to many relationship between the tables so you would have:

     

    Table 1 * <- 1 Dimension Group1 1 -> * Table 2

    Table 1 * <- 1 Dimension Group2 1 -> * Table 2

     

    That will help you achieve the result better, also believe that if you have the information as provided below you should also do a unpivot on each country name that would allow you to make a dimension table on country and facilitate the calculations.

     

    Then just use a measure:

    MEasure= SUM(Table1[Value])- SUM(Table2[Value])

     

    Or whatever is the calculation you need.

     

    Check PBIX file attach.