Forum Discussion

Falcon's avatar
Falcon
Helper I
2 years ago
Solved

Advance Query - load data from the latest date to current date

Hello all,   I am trying to load data using API which requires parameters "startDateTime" and "endDateTime" in the request URL. The data table has a date column. My plan is as follows. Run a firs...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Falcon ,

    lbendlin Thanks for your concern about this case!

    For "startDateTime", to extract the Maximum Date from Your Table, you can use the following M code to create a new query:

    let
        Source = YourTableName,
        MaxDate = Table.Max(Source, "YourDateColumnName")[YourDateColumnName]
    in
        MaxDate

    For the "endDateTime", you can directly use

    DateTime.LocalNow()

    in your API request URL or format it as needed.

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