cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
topkatt
Frequent Visitor

Breaking Ties in LOOKUPVALUE

I have a formula that accurately looks up the value of [TYPE] for an [ID] where Date = [Last Event Date]:

 

Last Type = (LOOKUPVALUE('Data'[TYPE],'Data'[ID],VALUES('Data'[ID]), 'Data'[Date], [Last Event Date]))

 

My question is how to alter this formula for cases where there are multiple rows with the same ID and Date but different values of TYPE?

 

Thanks for your help.

1 REPLY 1
Super User III
Super User III

Re: Breaking Ties in LOOKUPVALUE

Hey,

 

not sure if you want to create a calculated column or a measure, but basically you can try something like this (for a measure):

 

var currentID = CALCULATE(FIRSTNONBLANK('Data'[ID],1))
return
CALCULATE(
FIRSTNONBLANK('Data'[TYPE],1)
,FILTER(ALL('Data'[ID],'Data'[Date])
,'Data'[ID] = currentID && 'Data'[Date] = [Last Event Date]
)
)

Hopefully this is what you are looking for

 

Regards,

Tom

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors