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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ZikoPowerBI
Helper II
Helper II

How to take the max date from one table and pass it as a filter in another table while extracting.

Hi All ,

 

I have the following use case :

 

1. There are two tables one fact table and other is calendar table / Date table.

2. Both the tables come from Database using Direct query.

3. I Have to take the max date from fact table and and pass that date to Calendar table by filtering the date column while fetching the data. (I should be able to filter the data in Calendar table for only dates less than or equeal to the max date of the fact table).

 

I have created a reference table of fact table and in transform selected the latest date.

I have no clue was has to be done ahead.

 

Can anyone please help me to achieve this.

 

I referred the following link :

https://www.ehansalytics.com/blog/2019/3/17/create-a-dynamic-date-table-in-power-query

@powerquery

1 ACCEPTED SOLUTION
ZikoPowerBI
Helper II
Helper II

Hi All , 

 

Got through the appropriate answer to it :

 

While fetchoing the table using direct query we transformed and set the filter on the date 
sample filter code : 
table.selectedrows(Calendar,each[date] <List.Max (date) ))

View solution in original post

3 REPLIES 3
ZikoPowerBI
Helper II
Helper II

Hi All , 

 

Got through the appropriate answer to it :

 

While fetchoing the table using direct query we transformed and set the filter on the date 
sample filter code : 
table.selectedrows(Calendar,each[date] <List.Max (date) ))

Hi there, it's been a while, but can you please tell where do you enter this code? and here which is the fact table & the date table? table.selectedrows(Calendar,each[date] <List.Max (date) ))

 

I have the same problem - have to limit the date table according to the max date in fact table in Power query

 

Thanks in advance!

lbendlin
Super User
Super User

3. I Have to take the max date from fact table and and pass that date to Calendar table by filtering the date column while fetching the data. (I should be able to filter the data in Calendar table for only dates less than or equeal to the max date of the fact table).

You _can_ do that by allowing the search filter to flow from the fact to the dimension. But that is highly discouraged in a star schema.  It will probably be easier to generate a measure and use that for the extract.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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
Top Kudoed Authors