Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Power Query Formula to give dates based on another column

Hi Experts

 

Need a Power Query formula to give dates in the following format for each M value until last M value in M Column

So

M0 = 01/01/2012

M1 = 01/02/2012

M3 = 01/03/2012

and so on until M100 i.e. increment by a month

in sequence...

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Based on your description, you can create a custom column in Power Query.

    Date=Date.AddDays(#date(2012,1,1),Number.FromText(Text.End([M],Text.Length([M])-1)))

    Then transform the text type of the column into date type.

     

    Finally you can change the type to "mm/dd/yyyy" in data view or report view.

     

    Result:

     

    Hope that's what you were looking for.

    Best Regards,

    Yuna

     

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

     

     

3 Replies

  • Anonymous , Try a new column like

     

    Date.AddDays(Date.FromText("2012 01 01"), Text.End([Column], Text.Length([Column])-1)*1)

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks as always Amit

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Based on your description, you can create a custom column in Power Query.

    Date=Date.AddDays(#date(2012,1,1),Number.FromText(Text.End([M],Text.Length([M])-1)))

    Then transform the text type of the column into date type.

     

    Finally you can change the type to "mm/dd/yyyy" in data view or report view.

     

    Result:

     

    Hope that's what you were looking for.

    Best Regards,

    Yuna

     

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