cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
henriquerzatk
New Member

How can I: Returns the most recent value, filtering two dates.

Hi everyone.

 

I have the following situation:

 

I have two tables, and I need to create a column in table 2 (ID_2), which brings me ID_2 of type "Mtk", that its date_ID2 is the most recent, but less than the date_ID_3, from table 1; 

 

henriquerzatk_1-1669990170355.png

 

Thanks all. 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@henriquerzatk , New column in table2

 

Maxx(filter(Table1, Table1[ID_1] = Table2[ID_1] && Table1[Date_ID2] <= Table2[Date_ID3]), Table1[ID_2])



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@henriquerzatk , New column in table2

 

Maxx(filter(Table1, Table1[ID_1] = Table2[ID_1] && Table1[Date_ID2] <= Table2[Date_ID3]), Table1[ID_2])



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

Wow, thank you so much, this helped me a lot. 🙌

Now a second doubt, continuing in the same situation.

Is it possible, I determine a number of days, as a limit for it to pull or not the value of ID_2?

Example:

Only bring ID_2 if: Date_ID3 - Date_ID2 <= 120

Thanks.

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors