Forum Discussion
mb0307
Responsive Resident
4 years agoSUMX from two tables
Hi all,
I have two tables
- Forecast
- Sales
A simple measure to calculate difference between two:
Diff = ABS( [Forecast] - [Sales] )
Then I want sum of Diff by Month and Product, so written this measure:
Error Forecasting =
SUMX(
VALUES( ProductTable[ProductID] ),
[Diff]
This works fine if I am using columns from Product table as row header.
But if I want to use Month from Date table as subgroup/column then total doesn't add up correctly:
Total 11,585,881 is correct if I only use Product Group and number for each Month is correct. But total should be 16,915,804
Any solution amending the Error Forecasting measure please? you help is much appreciated.
Thanks
Hi,
Try this measure
Diff v3 = SUMX( generate(VALUES('Product'[Product ID] ),values('Date'[MonthNameShort])), [Diff] )
6 Replies
- Ashish_Mathur
Super User
Hi,
Share the link from where i can download your PBI file.
- mb0307
Responsive Resident
- Ashish_Mathur
Super User
Hi,
Try this measure
Diff v3 = SUMX( generate(VALUES('Product'[Product ID] ),values('Date'[MonthNameShort])), [Diff] )