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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
brief001
Helper II
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.

brief001_0-1646161904519.png

 

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
tamerj1
Super User
Super User

Hi @brief001 

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

View solution in original post

2 REPLIES 2
brief001
Helper II
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!

tamerj1
Super User
Super User

Hi @brief001 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors