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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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(...)...)



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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(...)...)



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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])

 



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors