Forum Discussion

dave_schultz's avatar
dave_schultz
Regular Visitor
3 years ago
Solved

Dynamic date/time change

Hi there,   Everyday, I want to add a dynamic filter looking at two day's ago with the the earliest time. For example for this morning: today is 2022-12-08. I want to get: 2022-12-08-0-0-0. Here is...
  • dave_schultz's avatar
    3 years ago

    Hi vicky_ 

     

    Thanks for responding. Looks like that returns only the date.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi dave_schultz ,

     

    Try the Date.StartOf Day function. It returns the start of the day represented by dateTimedateTime must be a datedatetime, or datetimezone value.

    let
    Source = DateTime.LocalNow(),
    #"Converted to Table" = #table(1, {{Source}}),
    #"Added Custom1" = Table.AddColumn(#"Converted to Table", "Custom.1", each Date.StartOfDay(Date.AddDays([Column1],-2)))
    in
        #"Added Custom1"

     

     

    Best Regards,

    Stephen Tao

     

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