Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a table with approx 6,000 rows. Then I have a report date in excel i.e. the date I run the report e.g. 22/07/2024. What I want to do is to refer to the date I run the report so I can perform calculations in the 6,000 rows. The report date is essentially a variable thats sits in excel and changes. I have tried a few things like importing the date as connection only, then adding a column with the reference for the report date variable but to no avail.
Any advise is much appreciated. I am sure there must be a way but I cannot figure it out!
Solved! Go to Solution.
Hi @Jimbo1980 ,
After I reviewed again, I understand that you want call a column from another table.
Try adding a custom column. #"tablename"[columnname].
#"Table (2)"[ReportDate]
[RpoertDate] is in Table(2).
Expand it.
You can see the [ReportDate] from Table(2) now is in Table.
Similar post:Solved: How to reference another table in Query Editor (M) - Microsoft Fabric Community
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I don't have access to my laptop at the moment. But ...
Give you query a name and you can use it in any expression...
so i have managed to add the report date as a query, I have drilled down. The reference for the date in power query appears to be '= #"Changed Type"{0}[Column1]'. But then if I go into another query how do i reference this report date query?
Make a named range in Excel that refers to the report run date. You can access this named range inpiwerquery as a separate query. You may want to transform it a bit depending on how you want to use it. Assuming you transform it to produce just the actual date value, you can use the name of your query anywhere you want the report run date.
Hi thanks for your reply,
So i have made a named range in excel called 'Report_Date' which refers to cell B2 the date (22/07/2024). But how do i refer to that variable in power query?
Hi @Jimbo1980 ,
Thanks for reaching out to the community.
To get the current date in Power Query, you can use the expression “= DateTime.Date (DateTime.LocalNow ())” in the Formula Bar. This generates the current datetime value in Power Query by using the DateTime.LocalNow function, which looks at the current date and time on your system.
DateTime.LocalNow - PowerQuery M | Microsoft Learn
How to Create Today's Date in Power Query M (gorilla.bi)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Stephen,
Thank you for your reply but unfortunately the current date isn't what I am looking for. I need to create a variable which I can type the report date in (This could be a date in the past). Then I can use this variable or object to refer to in my table of 6,000 rows to perform the necessary calculations.
Hi @Jimbo1980 ,
After I reviewed again, I understand that you want call a column from another table.
Try adding a custom column. #"tablename"[columnname].
#"Table (2)"[ReportDate]
[RpoertDate] is in Table(2).
Expand it.
You can see the [ReportDate] from Table(2) now is in Table.
Similar post:Solved: How to reference another table in Query Editor (M) - Microsoft Fabric Community
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for that Stephen that worked!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |