0
votes

enter image description here

I want to show in the Table 1 the sum of each SKU. The sum comes from the Table 2. I tried the following DAX code for table 1:

sumx(Filter(Table2[Sales],Related(Table1[Sales]),Table2[Sales])

I read the Summing up a related table's values in PowerPivot/DAX, but don't quite get it. My case is that I don't want to assign the primary key to Table 1 and assign the foreign key to Table 2.

Thanks a lot for any suggestion.

1

1 Answers

2
votes

So you want to add a calculated column into Table1 which is the sum of sales from Table2?

As long as you have a relationship between the tables in Power Pivot (where Table2[Sku] points to Table1[Sku]) then it is easy. The calculated column would be:

=CALCULATE(SUM(Table2[Sales]))