Hi to all!
I have a single table of values with brands, spends, months in the date format. One brans can have multiple spends during one months.
I have a few functions already intact:
Total Spends = sumx(reports; reports[Spends])
% of Spends =
CALCULATE(
divide(
[Total Spends];
CALCULATE(
SUM(reports[Spends]); all(reports[Brand]))))
(too many "CALCULATE" wraps?)
Then I need to create YOY spends change. Tried various functions, like
Spends PY total =
calculate(
sumx(reports; reports[Spends]);
PREVIOUSYEAR(reports[month_raw]))
And that gets me blanks in the Power BI matrix visualisation.
DATEADD version like this
Spends PY total =
calculate(
sumx(reports; reports[Spends]);
DATEADD(reports[month_raw]; -1; YEAR))
returns this error:
Error Message:
MdxScript(Model) (4, 2) 'reports'[Spends PY total]
And various DIVIDE functions don't work with this to create the needed percentage of change.
So, folks, what should I do?