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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Kacol
Regular Visitor

How can a certain query take a specific date from another query?

I have a certain query with lots of past and future dates, 
also I have added columns in it. Let's call it query number 1 My goal is that query number 1 will take a specific date from another query,
which is called query number 2,
this date must be yesterday's date.
So I created a formula in query number 2 that would get me the date directly. My question is how do I make the dates in query number 1 filter
according to the specific date I put in query number 2?

 

4 REPLIES 4
bhanu_gautam
Super User
Super User

@Kacol , Create a new query 2 

 

  let
         Yesterday = Date.From(DateTime.LocalNow()) - #duration(1, 0, 0, 0)
     in
         Yesterday
 
This will give yesterday's date
 
Create a relation between Query 1 and Query 2
 
Create a measure in Query 1 to filter on the basis of Query 2
 
FilteredData =
CALCULATE(
COUNTROWS(Query1),
Query1[DateColumn] = VALUES(Query2[Yesterday])
)
 
And use this measure in visuals



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks for the answer, but my problem is even more complex than I thought. 

I simply import data through external software, some of the tables include time, financial data, stocks, etc. Only from the moment I import the "time column" can I continue to import additional columns. The dates in "Time" are not defined as a date but as text. Once I change it from text to date format, I can't go ahead and import more data. That's why it's complicated. Is there some way to still filter the time so that it gives me yesterday's automatic date? The dates that appear are in the past and in the future. 

Kishore_KVN
Super User
Super User

Hello @Kacol ,

Don't create query2 with yesterdays date. Instead of that create a parameter in Power Query Editor for yesterday's date and use that parameter to filter this table. 

Please refer below video for details:

Power Query Parameters - Dynamically Change the Output of Your Queries Depending on Their Value - Yo...


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

Thanks for trying to help, but it still didn't solve my problem. I can't figure out how I still filter query number 1, what I saw in the video is just a parameter in the form of text.

I'm still not sure how to automatically filter by yesterday's date.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors