Forum Discussion

Nanakwame's avatar
Nanakwame
Helper II
4 years ago
Solved

Previous Month to Date Calculation based on current date

Hi All,   I have a function to calculate the PMTD (previous month to date) sales using the function below  PreviousMTD = TOTALMTD( SUM(Table[Value]) , DATEADD('Date'[Date], -1 , MONTH) ) I will l...
  • TheoC's avatar
    4 years ago

    Hi Nanakwame 

     

    If I am reading correctly, you are quite close.  I recommend creating three measures. The first is to sum the relevant values. The second to sum only the portion of the Current Month To Date.  The third is to mimic the position of the Current Month To Date measure.

    1. Sum Value = Sum ( 'Table'[Value] )
    2. Total CurMthTD = CALCULATE ( [Sum Value] , DATESMTD ( 'Date'[Date] ) )
    3. Total LstMthTD = CALCULATE ( [Total CurMthTD] , DATEADD ('Date'[Date] , -1 , MONTH ) )


    Hope this helps! 🙂

  • Nanakwame's avatar
    Nanakwame
    4 years ago

    Hi Theo,

     

    i tried the approach you provided and it seems like its calculating the 6 days for october comparing all of september. I will prefer it compare it to only 6 days in september as well and so on.