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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mwu1
New Member

Lookup value (with multiple results) from same table and with multiple filters

Hello, I have the following issue:

 

Context:

I currently have a report that tracks an activity log. 1 row = 1 activity. The row will tell us what is the activity (Activity ID (From)) and what is the next activity (Activity ID (To)) it triggers. Each row has a date-time (Activity Date) of when the Activity ID (From) happened. 

 

Objective:

For each row, I'd like to find out what is the Activity date for when Activity ID (from) = preceding Activity ID (to)

 

mwu1_1-1691376992441.png

 

 

I've tried the following formula

T0 = Calculate(firstNONBLANK(Reporting[ActivityDate], 1), Filter(Reporting, Reporting[ActivityToId] = EARLIER(Reporting[ActivityId])))
 
but it's only retrieving the first ever date of that activity instead of the closest preceding one. I would also like to add a filter so that it only looks up dates with the same Request ID (column A).
 
Thank you in advance!
2 REPLIES 2
mwu1
New Member

Managed to get an answer from further researching

 

T0 =
VAR _last_date = Reporting[ActivityDate]
RETURN
CALCULATE (
MAX ( Reporting[ActivityDate] ) ,
ALLEXCEPT ( Reporting , Reporting[ReqIDId] ) ,
Reporting[ActivityDate] < _last_date, Reporting[ActivityToId] = EARLIER(Reporting[ActivityId]))

Hi, @mwu1 

 

You have a great approach, thanks for sharing. You can accept your answer as a solution to help more people with similar problems.

 

Best Regards

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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