Forum Discussion

DeEviloN's avatar
DeEviloN
Helper III
4 years ago
Solved

PREVIOUSMONTH(DATESMTD

I have a measure that calculates based on the amount for the month of the last sales with the previous month when there were sales

 

Prev last MTD Sales = CALCULATE (SUM ('Добавить1'[Количество изделий всего, шт]), PREVIOUSMONTH(DATESMTD ('Добавить1'[Дата выдачи])))

 

But he does not always see the previous month of sales, how to fix it?

  • DeEviloN ,  Try like

     

    Last Month non Continuous = CALCULATE([sales],filter(ALL('Date'),eomonth('Date'[Date]) =eomonth( CALCUALTE( MAx(Table[Date]), FILTER(ALL('Date'),'Date'[Date]<max('Date'[Date]))),0)))

8 Replies

  • DeEviloN , You have to try like

     

    MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
    last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

     

    previous month value = CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))

      • amitchandak's avatar
        amitchandak
        Super User

        DeEviloN , Just a different measure in example ,

         

        like

         

        MTD = CALCULATE(SUM ('Добавить1'[Количество изделий всего, шт]),DATESMTD('Date'[Date]))
        last MTD = CALCULATE(SUM ('Добавить1'[Количество изделий всего, шт]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

         

        previous month = CALCULATE(SUM ('Добавить1'[Количество изделий всего, шт]),previousmonth('Date'[Date]))

    • DeEviloN's avatar
      DeEviloN
      Helper III

      This method does not work as the specified client made the payment in October, and before that in August

      • amitchandak's avatar
        amitchandak
        Super User

        DeEviloN ,  Try like

         

        Last Month non Continuous = CALCULATE([sales],filter(ALL('Date'),eomonth('Date'[Date]) =eomonth( CALCUALTE( MAx(Table[Date]), FILTER(ALL('Date'),'Date'[Date]<max('Date'[Date]))),0)))