Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Refresh M Query - Correct Syntax For Dates

I am exporting all data from a log table in App Insights to Power BI as an M query. I want to create a semantic model or dataflow in Power BI that allows me to refresh the data to retrieve the latest...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Please try this:

    let
        Source = YourTableName, // Replace with your actual data source
        CurrentDate = DateTime.From(DateTime.Date((DateTime.LocalNow()))),
        StartDate = DateTime.From((Date.AddDays(CurrentDate, -90))),
        FilteredRows = Table.SelectRows(Source, each [datetime] >= StartDate and [datetime] < Date.AddDays(CurrentDate,1))
    in
        FilteredRows

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group