Forum Discussion

Odada's avatar
Odada
Regular Visitor
3 years ago

Challenge returning dates between my startdate and enddate in power query

Good day all,

pls i have a challenge trying to get the dates in between my start and end date, i used the custom column M function  {Number.from{startdate}..{number.from{enddate} and it gives me the following error

Expression error, we cannot apply an index of a type date

details=[function]

Index= 1/1/2023

 

 

 

5 Replies

  • adudani's avatar
    adudani
    Memorable Member

    Odada ,

    create a column subtracting the two dates you want to find the range between by selecting both columns and "From Date& Time" -> Date -> Subtract Days.

     

    Then create a custom column using:

     

    List.Dates({startdate, subtraction, #duration(0,0,0,1)})

    Please accept this as the solution if this resolves your question.

     

    Appreciate a thumbs up if this is helpful.

     


     

  • Odada's avatar
    Odada
    Regular Visitor

    Thank you for your reply, i have tried it and it returned only 1/1/2023

    Is there something i can do pls

  • Odada's avatar
    Odada
    Regular Visitor

    Thank you for your reply, i have tried it and it returned only 1/1/2023

    Is there something i can do pls

    • latimeria's avatar
      latimeria
      Solution Specialist

      Hi Odada  ,

      Try this

       

      List.Dates([Targetdate] ,Number.From([EndTargetdate]-[Targetdate])+1,#duration(1,0,0,0))