Hi
I need some help with fancy DAX please. I need to calculate a percentage with Number of accounts by Category over a specifically calculated total in the previous month.
I bit difficult to explain, I’ve attached an excel file the will show what I’m after. I’m slicing by Company and Monthly date in the report. I’m really only interested in the high-lighted grouping, the rest can be grouped or ignored.
Couple of things to note, your Date table doesn’t meet some of the criteria for a proper Date table (for example it doesn’t cover full years) and wasn’t Marked as a Date table (you’ll find that option on the Table Tools ribbon)
In the Extended Date table topic you’ll find more on Date table requirements.
Next you’ve created an implicit measure by dragging a numeric field into the table visual values section. I can’t emphisize enough that it is important to always create basic Measures instead. Like:
Num of accounts = SUM( 'Extract'[Number of accounts] )
.
One of the most versatile time intelligence functions is DATEADD
Num of accounts PM =
CALCULATE( [Num of accounts],
DATEADD( 'Calendar table'[Date], -1, MONTH )
)
.
And for the % change
% MoM = DIVIDE( [Num of accounts], [Num of accounts PM] )
.
With this result, these don’t match your example but are correct based on the provided data.
Thank you so much, however the trick is that the Denominator is actually from a different grouping in the previous month. Like in the excel example. That is where I’m having issues.