cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nagaraj
Post Patron
Post Patron

LookupValue with Filter

Hi,

 

 Need help with DAX for below scenario

 

Scenario: Have TABLE1 and TABLE2, need to populate manager (in TABLE1) by having lookup (in TABLE2).

In TABLE2 i have multiple values for a single ID , i need to select the record where Type = MANAGER

 

Table 1

IdManager
1 
2 

 

Table 2 

IdnameType
1abcAssistant
1xyzManager
2bcdManager
2fghAssistant

 

Regards

Nagaraj

1 ACCEPTED SOLUTION

Hi @tctrout 

 

Thanks for the help, was able to resolve using below 

 

Property_Manager = CALCULATE(FIRSTNONBLANK(Table2[Name],1),
filter(all(Table2),
Table2[Type] ="Property Manager" &&
'Table1'[Id] = Table2[Id]))

View solution in original post

5 REPLIES 5
MG86
Helper I
Helper I

I know this is an older thread, but for future reference isn't it easier to just use the second lookup parameters of LOOKUPVALUE?:

LOOKUPVALUE(
   'Table2'[Name], 'Table2'[Id], 'Table1'[Id], 'Table2[Type], "Manager")

v-lid-msft
Community Support
Community Support

Hi @nagaraj ,

 

We can try to create a calculated column in 'Table 1' to meet your requirement:

Manager =
CALCULATE (
    MAX ( 'Table 2'[name] ),
    'Table 2'[Type] = "Manager",
    'Table 2'[id] = 'Table 1'[id]
)

 


Best regards,

 

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lid-msft 

 

 HI, 

 

 Thanks for the help, was able to resolve this using the below 

 

Property_Manager = CALCULATE(FIRSTNONBLANK(Table2[Name],1),
filter(all(Table2),
Table2[Type] ="Property Manager" &&
'Table1'[Id] = Table2[Id]))

tctrout
Resolver III
Resolver III

The approach I would explore in M Code, not DAX.. This can be done within the GUI interface

 

Create copy of Table 2

Filter for Manager only

Remove duplicates on ID, if eixists.  This should provide you a table of manangers, their names and ID

 

Go to Table 1 and merge table 2 using ID as the key/lookup value.

Hi @tctrout 

 

Thanks for the help, was able to resolve using below 

 

Property_Manager = CALCULATE(FIRSTNONBLANK(Table2[Name],1),
filter(all(Table2),
Table2[Type] ="Property Manager" &&
'Table1'[Id] = Table2[Id]))

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors