Forum Discussion

JeroenHD's avatar
JeroenHD
Icon for Helper I rankHelper I
5 years ago
Solved

date.Isinpreviousn Year strange result

Hello Team,  I have a question, because this appears kind of strange to me. Probably there's a good explanation for this, but i don't see it.    I have added a column with IsInPreviousNYears([Cu...
  • v-alq-msft's avatar
    5 years ago

    Hi, JeroenHD 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

    Table:

     

    You may add a new step with the following m codes.

    = Table.AddColumn(#"Changed Type", "Custom", each let 
    end = Date.From(DateTime.LocalNow()),
    start = Date.AddYears(end,-8)
    in 
    [Date]>=start and [Date]<=end)

     

    Result(Today is 3/4/2021):

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.