Forum Discussion
MoM calculation not working
Hi all!
I've been having some problems while I'm calculating MoM change. I'm going to detail the steps for my calculation below:
1. Calculate the running total of my variable with the following dax equation:
TotalRevenue running total =
CALCULATE(
[TotalRevenue]-[LostRevenueSum],
FILTER(
ALLSELECTED(DateTable[Date]),
ISONORAFTER(DateTable[Date], MAX(DateTable[Date]), DESC)
)
,USERELATIONSHIP(subscription[DateSubscribed],DateTable[Date])
)
2. Calculate the MoM change%
TotalRevenue MoM% =
VAR __PREV_MONTH = CALCULATE([TotalRevenue running total], DATEADD(DateTable[Date], -1, MONTH),
USERELATIONSHIP(subscription[DateSubscribed],DateTable[Date])
)
RETURN
DIVIDE([TotalRevenue running total] - __PREV_MONTH, __PREV_MONTH,0)
The problem is that I get wrong results for the curret month (January in this case) as I show below (It should be 3.95%). I'm not sure why this is happening...
If I use the MoM change formula with a .[Date] like this, it works but creates an extra month
TotalRevenue MoM% =
VAR __PREV_MONTH = CALCULATE([TotalRevenue running total], DATEADD(DateTable[Date].[Date], -1, MONTH),
USERELATIONSHIP(subscription[DateSubscribed],DateTable[Date])
)
RETURN
DIVIDE([TotalRevenue running total] - __PREV_MONTH, __PREV_MONTH,0)
Does anyone have any idea what I'm doing wrong?
5 Replies
- parry2k
Super User
ds_br123 mark your date table as date table and don't use .date.
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- v-lionel-msft
Community Support
Hi ds_br123 ,
I guess it is because of the date hierarchy used in your table visual that caused this problem.
If you don't use the date hierarchy and create year, quarter, and month columns, you will get the correct result.'Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- v-lionel-msft
Community Support
Hi ds_br123 ,
Has your problem been solved?
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.