Forum Discussion
Month on Month variance percentage
- Anonymous1 year ago
Hi jayceeb
Thank you for reaching out to the Microsoft Fabric Forum Community.
Please try the DAX below. If you continue to experience any issues, feel free to reach out here. We are happy to assist you.MOM% =
VAR CurrentMonth = MAX(DateFilter[Custom])
VAR PrevMonth =
CALCULATE(
MAX(DateFilter[Custom]),
FILTER(
ALL(DateFilter),
DateFilter[Custom] < CurrentMonth
)
)
VAR CurrentVariance = [OB comp]
VAR PreviousVariance =
CALCULATE(
[OB comp],
FILTER(
ALL(DateFilter),
DateFilter[Custom] = PrevMonth
)
)
RETURN
IF(
ISBLANK(PreviousVariance),
BLANK(),
DIVIDE(CurrentVariance - PreviousVariance, PreviousVariance)
)
Thanks.
jayceeb , Try using
DAX
MOM% =
VAR CurrentMonth = MAX(DateFilter[Custom])
VAR PrevMonth =
CALCULATE(
MAX(DateFilter[Custom]),
FILTER(
ALL(DateFilter),
DateFilter[Custom] < CurrentMonth
)
)
VAR CurrentVariance = [OB comp]
VAR PreviousVariance =
CALCULATE(
[OB comp],
DateFilter[Custom] = PrevMonth
)
RETURN
IF(
ISBLANK(PreviousVariance),
BLANK(), // Or you can return CurrentVariance or any other value you find meaningful
(CurrentVariance - PreviousVariance) / PreviousVariance
)
still 0.00%. if previous month is filtered the result should not be change as per below🙏