Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
staincross
New Member

Reference a date field in spreadsheet

Hi There,

 

I have multiple Excel Power Queries that use the same dates - example line:

= Table.SelectRows(#"Filtered Rows", each [Created On] < #datetime(2022, 1, 11, 0, 0, 0))

 

I would like the #datetime to reference a date field in my spreadsheet so I just update the one cell for all queries.

staincross_0-1642023042420.png

 

How can I go about referencing this please?

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @staincross 

Method1:

Create a blank query, open Advanced Editor and replace the text there with the code below.  

let
    Source = #datetime(2021, 10, 1, 0, 0, 0)
in
    Source

Rename the query name(date1) and modify the date you want in the advanced editor.

= Table.SelectRows(#"Changed Type", each [Date] > date1)

Method2:

Select the date of the cell you want, load the date into Power Query, and check with or without table header.
Then modify the loaded query, add the following code at the end of the query, and rename the query name.

{0}[Rdatetime]
// or
{0}[Column1]

vangzhengmsft_3-1642561246122.png

vangzhengmsft_4-1642561433224.png

 

Result:

vangzhengmsft_0-1642560854086.png

vangzhengmsft_5-1642561530191.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

View solution in original post

4 REPLIES 4
v-angzheng-msft
Community Support
Community Support

Hi, @staincross 

Method1:

Create a blank query, open Advanced Editor and replace the text there with the code below.  

let
    Source = #datetime(2021, 10, 1, 0, 0, 0)
in
    Source

Rename the query name(date1) and modify the date you want in the advanced editor.

= Table.SelectRows(#"Changed Type", each [Date] > date1)

Method2:

Select the date of the cell you want, load the date into Power Query, and check with or without table header.
Then modify the loaded query, add the following code at the end of the query, and rename the query name.

{0}[Rdatetime]
// or
{0}[Column1]

vangzhengmsft_3-1642561246122.png

vangzhengmsft_4-1642561433224.png

 

Result:

vangzhengmsft_0-1642560854086.png

vangzhengmsft_5-1642561530191.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

AlexisOlson
Super User
Super User

You can load cells into Power Query if they are a named range like this:

Excel.CurrentWorkbook(){[Name=rangeName]}[Content]{0}[Column1]

 

See an example here:

https://stackoverflow.com/questions/49281763/powerquery-use-a-cell-values-in-a-url

Thanks.  I'm sure that's a good answer for a lot of people who know their way around, but unfortunately, I'm pretty green and don't really get it.

If you have specific questions, then ask. I can't tell which part you don't get.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.