Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Sum Previous Month

Hello! 

 

I have a table that is currently calculating monthly totals from another related table. Here is what my table and CurrentMonthCalculation looks like:

 

FormTotalMonth = 
CALCULATE(
    SUM('Activated Forms'[ActivatedFormCount]),
    FILTER('Activated Forms', 'Activated Forms'[Organization_Id] = AccountActivity[Id]),
    FILTER('Activated Forms', 'Activated Forms'[FormCreatedMonth] = AccountActivity[AccountActivityJoinDate])) +0

I would like to do the exact same calculation, except have the results appear in my table one month prior so that I can see the previous months total for that month. How would I go about that?

 

Desired outcome: 

 

Thanks! 

 

  • Hi Anonymous,

     

    I would suggest you create a new Date table and try the function dax/previousmonth-function-dax.

    The two measure could be like this.

    FormTotalMonth = 
    CALCULATE(
        SUM('Activated Forms'[ActivatedFormCount]),
        FILTER('Activated Forms', 'Activated Forms'[Organization_Id] = AccountActivity[Id]))
    FormTotalPrevMonth =
    CALCULATE ( [FormTotalMonth], PREVIOUSMONTH ( 'date'[date] ) )
    

     

     

    Best Regards,
    Dale

2 Replies