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
Anonymous
Not applicable

When value is present in column, find matching value on another row and supply another column value

Hello,

 

I'm attempting to make a DAX that uses the member_id in the reports_to column, to lookup the title for that member ID so I can make a dynamic grouping based on Title of the member_id that people report to.

 

member_idReports_ToTitle
Nhamilton Business Manager
BMamrakNHamiltonAdmin
LGlickmanNHamiltonAdmin
MHollandNHamiltonAdmin
SPrice2NHamiltonAdmin

 

This is just a small sample from the dataset, please let me know if I can help with any additional details.

 

Thanks,

Seth

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Not sure I am 100% following but generally LOOKUPVALUE or MAXX(FILTER(...)...)


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

@Greg_Deckler 

 

That gave me the same result for all rows. I figured it out with LOOKUPVALUE, I had one of the columns in the wrong place, when switched it properly had a single value and returned what I was looking for.

 
Column = LOOKUPVALUE(v_rpt_Member[Title],v_rpt_Member[Member_ID],v_rpt_Member[Reports_To])

 

Thanks for the original answer and help with this!

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Greg_Deckler
Super User
Super User

Not sure I am 100% following but generally LOOKUPVALUE or MAXX(FILTER(...)...)


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

 

I tried the below, but getting "a table of multiple values was supplied where a single value was expected"

 

LOOKUPVALUE(v_rpt_Member[Title],v_rpt_Member[Reports_To],v_rpt_Member[Member_ID])
 
I'm trying to create a new column that basically has the "Title of reports to" or the title of the person they report to. My dataset has 492 rows with numerous different reports_to values, so that initial table is a small snippet. 
 
This is the result I would like to see (red text is new column that does not yet exist), and have it dynamically lookup the Title so that when folks change roles it uses the new reports_to member_id to lookup title.
 
member_idReports_ToTitleTitle of Reports_to
Nhamilton Business Manager 
BMamrakNHamiltonAdminBusiness Manager
LGlickmanNHamiltonAdminBusiness Manager
MHollandNHamiltonAdminBusiness Manager
SPrice2NHamiltonAdminBusiness Manager
Jclark Sales Director 
ScalkinsJclarksalesSales Director
AkoonJclarksalesSales Director

 

Hope that helps clarify what I'm trying to accomplish. Thanks for your help.

 

 

Hmm, maybe:

 

Column = 
  MAXX(FILTER('Table',[member_id] = [Reports_To]),[Title])

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

 

That gave me the same result for all rows. I figured it out with LOOKUPVALUE, I had one of the columns in the wrong place, when switched it properly had a single value and returned what I was looking for.

 
Column = LOOKUPVALUE(v_rpt_Member[Title],v_rpt_Member[Member_ID],v_rpt_Member[Reports_To])

 

Thanks for the original answer and help with this!

Sorry, guess I should have actually tested that code! :S

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.