Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi, I tried lookupvalue and calculate but can't get the result I need. Any help is appreciated. Thanks!
Assigned = CALCULATE(FIRSTNONBLANK(Table[Assignee],1),FILTER(ALL(Table[Assignee]),Table[EndDate]=Table[AssigneeEndDate]))
Assigned =
VAR Key =
MIN(Table[ID])
VAR LatestStatusDate =
CALCULATE(
MAX(Table[EndDate]),
Table[ID] = Key
)
VAR LatestAssignee =
LOOKUPVALUE(
Table[Assignee],
Table[Key], Key,
Table[AssigneeEndDate], LatestStatusDate
)
RETURN
LatestAssignee
Table
| ID | StartDate | EndDate | Status | AssigneeEndDate | Assignee |
| 1 | 9/1/2023 | 9/3/2023 | Start | null | null |
| 1 | 9/4/2023 | 9/5/2023 | In Progress | null | null |
| 1 | 9/6/2023 | null | Complete | null | null |
| 1 | null | null | null | 9/1/2023 | null |
| 1 | null | null | null | 9/3/2023 | A |
| 1 | null | null | null | 9/5/2023 | B |
| 1 | null | null | null | null | C |
Result
| ID | StartDate | EndDate | Status | Assignee |
| 1 | 9/1/2023 | 9/3/2023 | Start | A |
| 1 | 9/4/2023 | 9/5/2023 | In Progress | B |
| 1 | 9/6/2023 | null | Complete | C |
Hi @AC2023 ,
Here are the steps you can follow:
1. Create measure.
Measure =
MAXX(
FILTER(ALL('Table'),
'Table'[EndDate] in SELECTCOLUMNS('Table',"1",[AssigneeEndDate])),[StartDate])Measure 2 =
MAXX(
FILTER(ALL('Table'),
[Measure]=MAX('Table'[StartDate])),[Assignee])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Anonymous,
Thank you! This works great with the sample data I provided, and it gives the correct desired result. However, when I applied this to my actual table which is huge, I got the error message "Resources Exceeded. This visual has exceeded the available resources. Try filtering to decrease the amount of data displayed." Any ideas how to fix this error?
It looks like you want to assign the "Assignee" value to each row in your table based on certain conditions. To achieve this, you can use DAX measures and a combination of functions to perform the lookup and assignment. Here's a modified version of your DAX code to achieve the desired result:
Assigned =
VAR Key =
Table[ID]
VAR LatestStatusDate =
CALCULATE(
MAX(Table[EndDate]),
FILTER(Table, Table[ID] = Key)
)
VAR LatestAssignee =
CALCULATE(
MAX(Table[Assignee]),
FILTER(
Table,
Table[ID] = Key &&
Table[AssigneeEndDate] <= LatestStatusDate
)
)
RETURN
LatestAssignee
This code should assign the appropriate "Assignee" value to each row based on the conditions you specified. The key points in this code are:
When you use this measure in your table, it should give you the desired result, as shown in your "Result" section.
Thank you for the DAX code, but it's not returing the desired result.
This problem can easily done in SQL query using self left join.
Here's SQL query, the 1st select is the data from the table, the 2nd select is the correct desired result:
Note that in this sample data, I added the Type field to make it easy to get the correct result.
This is the result in Power BI:
DAX for Assigned:
I get the same result whether I've the extra filter on TempTable[Type] or not.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |