Forum Discussion

sakamotothais's avatar
sakamotothais
Icon for Helper III rankHelper III
8 years ago
Solved

filter automatic date in power BI language M

Hi,   Need help. I'm trying to leave my auto filter, so it updates itself. My connection is direct and I am using the language M I want it to always select the current date today, the date fro...
  • MarcelBeug's avatar
    MarcelBeug
    8 years ago

    You can take a look at my post again.

     

    So my suggestion would be to adjust your code to take the date from your BookingDate; untested:

     

    let
        Source = Sql.Database("10.0.6.70,1433", "DailyBookings34"),
        DMBookings_BookingByLeg = Source{[Schema="DMBookings",Item="BookingByLeg"]}[Data],
        #"Filtered Rows" = Table.SelectRows(DMBookings_BookingByLeg, each Date.From([BookingDate]) = Date.From (DateTime.LocalNow ()) or Date.From([BookingDate]) = Date.AddDays (Date.From (DateTime.LocalNow ()) , -1) or Date.From([BookingDate]) = Date.AddDays (Date.From (DateTime.LocalNow ()), -7))
    in
        #"Filtered Rows"