DAX Revenue Previous Month Reply

Continuing the discussion from DAX Revenue Previous Month:

I was unable to reply to the post by @Remi10, so I’ve added comments here.

I understand your question to be that you want to calculate month-over-month change, but for the first month in the period rather than setting the value to blank (as in column MOM_1 below) you want to report that first month’s value (as in column MOM_2 below):

image

If that is what you meant, you could calculate

previous month
PM = 
VAR CurrentYearMonthNumber = SELECTEDVALUE ( 'DIM: Date'[MonthnYear] )
VAR PreviousYearMonthNumber = CurrentYearMonthNumber - 1
VAR Result =
    CALCULATE (
        [001. Revenues ((kUSD)],
        REMOVEFILTERS ( 'DIM: Date' ),
        'DIM: Date'[MonthnYear]  = PreviousYearMonthNumber
    )
RETURN
    Result
month-over-month
MOM_1 = 
VAR ValueCurrentPeriod = [001. Revenues ((kUSD)]
VAR ValuePreviousPeriod = [PM]
VAR Result =
    IF (
        NOT ISBLANK ( ValueCurrentPeriod ) && NOT ISBLANK ( ValuePreviousPeriod ),
        ValueCurrentPeriod - ValuePreviousPeriod
    )
RETURN
    Result

MOM_2 = 
VAR ValueCurrentPeriod = [001. Revenues ((kUSD)]
VAR ValuePreviousPeriod = [PM]
VAR Result =
    IF (
        NOT ISBLANK ( ValueCurrentPeriod ) && NOT ISBLANK ( ValuePreviousPeriod ),
        ValueCurrentPeriod - ValuePreviousPeriod
    )
RETURN
    IF(
        MAX('DIM: Date'[Month])=1
        , ValueCurrentPeriod
        ,Result
    )

1 Like

Hi @HufferD ,

It’s perfect thank you very much! :grinning:

Remi

@HufferD
I also need to perform this formula in Power Pivot would you have the solution please?
Thanks
Remi