Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

leap year correction

Hi, 

 

I have made measures that show last 12 and 24 months (rolling 12 month/24 months), 
When I select year 2020 I get a wrong value for February. 

case sales:

2019 value 28th feb = 20


year           last 12 month   last 24 month
2020                                   (2019)
feb            10                       40
28th          10                       20
29th           -                         20

There is an extra line for the 29th day in feb-2020 and this get the same value as 28th feb 2019. How can I correct for the leap year error?

N is number of months

 

Salgsinntekt forrige N mnd =
var Ldato = DATE(MAX('Year'[year]);MAX(Mnd[order])+1;1)
var Fdato = EDATE(Ldato;-(MAX(N[N])))
var Sales = CALCULATE([Sales];SAMEPERIODLASTYEAR(Calendar[date]))

return
if(min(Calender[date])<Fdato;
       blank();
           if(min(Calender[date])>=Ldato;
             blank();
                Sales)



1 Reply

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

     

    I'm not very clear about your requirements. Can you give me more information?

     

     

    Best Regards,

    Icey