Forum Discussion

Gazsim44's avatar
Gazsim44
Icon for Helper III rankHelper III
6 years ago
Solved

Current and Prior Month without Date Filter / Slicer

Hi All, 

 

I currently have a couple of measures setup to monitor profit based on comparing the current month (to date) v the prior month (to date). However on the 1st of each month I have to go and change the filter to reflect the current month and was wondering if there is a way I can avoid doing this so that the measure automatically picks this up each month and acts accordingly?

 

My current measure(s) are as follows although I have tried several, the majority of which come up with the same problem and produce the same results.

Current Month GP = CALCULATE(SUM(Air[Gross Profit]),
FILTER('Date',MONTH('Date'[Date]) = MONTH(TODAY())),
FILTER('Date',YEAR('Date'[Date]) = YEAR(TODAY()))
)
Prior Month GP = CALCULATE([Total GP Air],
DATEADD(FILTER(DATESMTD('Date'[Date]),'Date'[Date]<TODAY()),-1,MONTH))

Many thanks, 

  • parry2k's avatar
    parry2k
    6 years ago

    Gazsim44 look at relative date filtering.

     

     

    I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

     

4 Replies

    • Gazsim44's avatar
      Gazsim44
      Icon for Helper III rankHelper III

      Hi, I have simply setup a filter on the visuals concerned to change the month which in turn is taken from the date table, 

       

      Thanks, 

       

      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        Gazsim44 look at relative date filtering.

         

         

        I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!