Filter excel query to show tomorrow and after only.

chrisgarcia78

New Member
Joined
Jun 15, 2024
Messages
31
Office Version
  1. 2021
Platform
  1. Windows
Hi, I have the following row in the excel query advanced editor and it shows the current day only, but I would like to show everything after today, excluding today and previous days.
#"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each Date.IsInCurrentDay([Start])),

Thank you
 
Try this: #"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each [Start]> Number.From(DateTime.From(DateTime.LocalNow()+1)))

Cannot test as you have not provided any sample data. If this does not resolve, then suggest you post sample data employing XL2BB as suggested in Post #4
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try this: #"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each [Start]> Number.From(DateTime.From(DateTime.LocalNow()+1)))

Cannot test as you have not provided any sample data. If this does not resolve, then suggest you post sample data employing XL2BB as suggested in Post #4
I tried this but I get the following error message

Expression.Error: We cannot apply operator + to types DateTime and Number.
 
Upvote 0
Twice asked for sample data. Good Luck. I'm out. I can't read minds anymore. Good bye.
 
Upvote 0
Twice asked for sample data. Good Luck. I'm out. I can't read minds anymore. Good bye.
I don’t understand which sample data to share, if someone can please help I have an excel table that query data from a calendar and I get all the data that includes date so Im trying to filter the current and previous dates to show only the current day and after. To do this in excel I go to queries and connections then I click on the query that I previously added where I have some options to filter like “yesterday, today, tomorrow” but no option to filter today and before so I click on the advanced editor where I can manually change the code.
 
Upvote 0
When I use this code works but it shows the current day and after.
#"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each [Start] > Number.From(DateTime.From(DateTime.LocalNow())))

When I add +1 as follows I get an error
#"Filtered Rows" = Table.SelectRows(#"Sorted Rows", each [Start]> Number.From(DateTime.From(DateTime.LocalNow()+1)))

Error
Expression.Error: We cannot apply operator + to types DateTime and Number.
 
Upvote 0
I was able to make this work and I'm posting the code here in case someone else needs this solution.
If you are using exchange contents, none of the previous solutions will work.

The +1 does not work in any way.
The type needs to be changed to "date" instead of "datetime"
The > DateTime.From needs to be changed to > Date.From only

Code:
let
    Source = Exchange.Contents("INFO************.COM"),
    Calendar = Source{[Name="Calendar"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Calendar,{{"Start", type date}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Start] > Date.From(DateTime.LocalNow()))
in
    #"Filtered Rows"
 
Upvote 0
I was able to make this work and I'm posting the code here in case someone else needs this solution.
If you are using exchange contents, none of the previous solutions will work.

The +1 does not work in any way.
The type needs to be changed to "date" instead of "datetime"
The > DateTime.From needs to be changed to > Date.From only

Code:
let
    Source = Exchange.Contents("INFO************.COM"),
    Calendar = Source{[Name="Calendar"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Calendar,{{"Start", type date}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Start] > Date.From(DateTime.LocalNow()))
in
    #"Filtered Rows"

With this solution I don't see the current day and before which is what I wanted, but only shows the date and no time, it shows the date and 12:00:00 AM for all lines, is there anyway to make this work and also shows the date and time?
 
Upvote 0
With this solution I don't see the current day and before which is what I wanted, but only shows the date and no time, it shows the date and 12:00:00 AM for all lines, is there anyway to make this work and also shows the date and time?

Ok I found the solution to get the date and time and still filter today's date by just adding another line of code with "each not" for the current day and change "date" back to "datetime"

Code:
let
    Source = Exchange.Contents("INFO........................COM"),
    Calendar = Source{[Name="Calendar"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(#"Calendar",{{"Start", type datetime}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Start] > DateTime.From(DateTime.LocalNow())),
    #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each not Date.IsInCurrentDay([Start]))
in
    #"Filtered Rows1"
 
Upvote 0

Forum statistics

Threads
1,223,953
Messages
6,175,598
Members
452,658
Latest member
GStorm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top