cancel
Showing results for
Did you mean:
Helper II

## Lookup value within date range

I'm looking for a dax formula for a calculated column, which searches by name and between two dates.
In the picture below the explanation. I'm looking for a DAX formula (calculated column) for the orange column in table_1.

I have found many similar questions with solutions on the internet. However, those solutions just don't work. I hope someone can help me with the final solution through this community site.

Thanks in advance for the help!
Bas.

1 ACCEPTED SOLUTION
Super User

You may try

VAR CurrentName = Table_1[Name]
VAR CurrentDate = Table_1[Date]
VAR FilterTable =
FILTER (

Table_2,

Table_2[Name] = CurrentName

&& Table_2[Date_Start] <= CurrentDate

&& Table_2[Date_End] >= CurrentDate

)

VAR Result =
MAXX ( FilteredTable, Table_2[Team] )

RETURN

Result

2 REPLIES 2
Helper II

Thank you very much, this formula does indeed work. One note though, I had to change "MAXX ( FilteredTable, Table_2[Team] )" to "MAXX ( FilterTable, Table_2[Team] )".

Thank you, I am very happy to have been helped so quickly!

Super User

You may try

VAR CurrentName = Table_1[Name]
VAR CurrentDate = Table_1[Date]
VAR FilterTable =
FILTER (

Table_2,

Table_2[Name] = CurrentName

&& Table_2[Date_Start] <= CurrentDate

&& Table_2[Date_End] >= CurrentDate

)

VAR Result =
MAXX ( FilteredTable, Table_2[Team] )

RETURN

Result

Announcements

#### 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.

#### 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!

#### Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

#### Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors