Forum Discussion

IanLittlejohn's avatar
IanLittlejohn
New Member
7 years ago

DatesInPeriod with Leap Year

I'm using a DatesInPeriod with an =Calculate formula.  The DatesInPeriod goes 6 months back,  This works perfectly, except for Feb 2016 which is a leap year.  It calculates 7 months.  Has anybody else had this problem with the leap year?  

5 Replies

  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi IanLittlejohn

    How do you write the formula? it is a calculated column or a measure?

    Could you share me the formula nad the screenshot when apply the formula?

     

    I test with the following formula, it calculate the value from 2015/9/1~2016/2/29, Does this meet your need?

    Column = CALCULATE(SUM(Sheet2[value]),DATESINPERIOD(Sheet2[date],DATE(2016,2,29),-6,MONTH))

     

     

    Best Regards

    Maggie

  • Hi,

     

    Try this measure

     

    =CALCULATE(SUM(Data[Value]),EDATE(MIN(Calendar[Date]),-6))

     

    There should be a relationship from the Date column of the Data Table to the Date column of the Calendar Table.  Ensure that in the filter or slicer, you select any one month.

     

    Hope this helps.

    • IanLittlejohn's avatar
      IanLittlejohn
      New Member

      Hi Ashish, I tied using the edate but it returns one value for the last 6 months.  I'm looking for a rolling 6 months total to be calculated. Thanks for the suggestion