Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Revenue Formula?

I have this table:

 

Columns are simply [Revenue] and [Invoice Date]. How can I get the total of the highlighted rows? The idea is to gather the sum of the last 3 months while excluding the current month revenue. So I would need the sum of Feb-Apr and as each month progresses the formula would look back on the past 3 months while excluding the current month. So on June 1st the formula would then gather the sum of Mar-May, July 1st it would be Apr-June, etc. etc.

  • Hi mrainey,

     

    To achieve your requirement, create a measure using DAX formula like this pattern. 

    Total =
    CALCULATE (
        SUM ( table[value] ),
        FILTER (
            table,
            table[date]
                >= EOMONTH ( table[date], -5 ) + 1
                && table[date] <= EOMONTH ( table[date], -1 )
        )
    )
    

    Regards,

    Jimmy Tao

1 Reply

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    Hi mrainey,

     

    To achieve your requirement, create a measure using DAX formula like this pattern. 

    Total =
    CALCULATE (
        SUM ( table[value] ),
        FILTER (
            table,
            table[date]
                >= EOMONTH ( table[date], -5 ) + 1
                && table[date] <= EOMONTH ( table[date], -1 )
        )
    )
    

    Regards,

    Jimmy Tao