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
adriansuteu
Advocate I
Advocate I

Force RELATED() to take into consideration a certain relationship from the existing ones

I have extracted data from my CRM with PowerBI and I have the following relationships between tables Leads an Users:

 

LEADS:                              USERS

CreatedBy (Userid)            *--1    Id

ModifiedBy (Userid)          *--1     Id

Owner (Userid)                 *--1     Id

 

I want to create a vizualization that shows the number of Leads / Owner NAME.

 

But If I create a new column in the Leads table with the formula OwnerName = concatenate(related(User[FirstName]),concatenate(" ",related(User[LastName]))) and I use OwnerName as axis it takes into consideration the first relationship (based on CreatedBy column. How do I get it to take into consideration the Owner column?

 

Thanks

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @adriansuteu,

 

According to your description, you want to get the related user name based on owner, right?

If this is a case, you can refer to below formulas to get related user name.

 

Capture2.PNG

 

Calculate column:

 

USERELATIONSHIP Function:
Owner Name = CALCULATE(CALCULATE(VALUES(User[Last Name])&" "&VALUES(User[First Name]),LEADS),USERELATIONSHIP(LEADS[Owner],User[User ID]),ALL(User))

LOOKUPVALUE Function:
Owen Name 2 = LOOKUPVALUE(User[Last Name],User[User ID],LEADS[Owner])&" "& LOOKUPVALUE(User[First Name],User[User ID],LEADS[Owner]) 

 

Result:

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @adriansuteu,

 

According to your description, you want to get the related user name based on owner, right?

If this is a case, you can refer to below formulas to get related user name.

 

Capture2.PNG

 

Calculate column:

 

USERELATIONSHIP Function:
Owner Name = CALCULATE(CALCULATE(VALUES(User[Last Name])&" "&VALUES(User[First Name]),LEADS),USERELATIONSHIP(LEADS[Owner],User[User ID]),ALL(User))

LOOKUPVALUE Function:
Owen Name 2 = LOOKUPVALUE(User[Last Name],User[User ID],LEADS[Owner])&" "& LOOKUPVALUE(User[First Name],User[User ID],LEADS[Owner]) 

 

Result:

 

Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.