Forum Discussion
filter automatic date in power BI language M
- 9 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"
Hi,
Real Code:
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 [BookingDate] = Date.From (DateTime.LocalNow () or [BookingDate] = Date.AddDays (Date.From (DateTime.LocalNow ()) , -1) or [BookingDate] = Date.AddDays (Date.From (DateTime.LocalNow ()), -7)) )
in
#"Filtered Rows"
Thank you
Thanks, that confirms my suspicion of a misplaced parenthesis.
- MarcelBeug9 years ago
Community Champion
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" - sakamotothais9 years ago
Helper III
I'm still missing something, I have not given it.
- MarcelBeug9 years ago
Community Champion
Do you really expect us to figure out what you are missing???
Let me guess: your error message has gone (congratulations!).
Ah, you don't have records?
In your print screen we are really not able to see if there are any records before filtering that should have been kept.
We are volunteers trying to help you; not the ones that are causing you all your troubles.
So please try and be more reasonable.
- sakamotothais9 years ago
Helper III
I think it has nothing in my code, it's still simple, and I'm investigating to try to understand why the dates are not coming.
After all, he does not point out any mistakes, as you can see.
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 [BookingDate] = Date.From (DateTime.LocalNow ()) or [BookingDate] = Date.AddDays (Date.From (DateTime.LocalNow ()) , -1) or [BookingDate] = Date.AddDays (Date.From (DateTime.LocalNow ()), -7)) in #"Filtered Rows"And I have previous records yes
- MarcelBeug9 years ago
Community Champion
You are still not sharing the relevant information.
Please share a screenshot from the previous step, proving that you have data in your table that should be kept after filtering.
Edit: OK after your edit of the previous post I see that you don't have dates in your BookingDate column, so that's why nothing is left after filtering.
- sakamotothais9 years ago
Helper III
already shared, look at the post again
without the filter I want to mount, making the filter slicer
- sakamotothais9 years ago
Helper III
Dude, it worked, excuse me for any inconvenience. Thank you, thank you.
Thank You