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

Two Tables, Two Relationships

The Background: I have 2 tables (UserAccount & Tasks). UserAccount has UserID. Tasks has UserID AND AssignedByUserID.

 

The Story: A user can take a task or a user can be assigned a task by a higher role user. A relationship exists between UserAccount.Userid == Tasks.UserID. So any visual only shows the user who has the task, not the Assigner

 

 The Problem: I want to see who assigns tasks and to whom. 

 

I see this as the classical SQL problem of showing all employees and their managers who are also employees. I know in SQL to create 2 aliases for the same table and compare the userids as manager or not. In Power BI I don't know how to do it.

 

UPDATE: I've written a DAX IF statement where IF UserID = AssignedByUserID, 0, UserID, but I still can't get the user's name.

 

 

UPDATE: I've used the link: https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

Created a new table and linked it to Tasks.AssignedByUserID.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , In Power BI You can create two joins one active and one inactive. And you can activate join using use relation.

 

refer example :

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

But as in this case you need filter both or you filter one and see others. You might need to copy the table.

 

Create one more copy of the table

 

User 1 = Distinct (User)

or

User 1 = user

 

If use name is available in , we sometime use from the fact for display purpose

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , In Power BI You can create two joins one active and one inactive. And you can activate join using use relation.

 

refer example :

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

But as in this case you need filter both or you filter one and see others. You might need to copy the table.

 

Create one more copy of the table

 

User 1 = Distinct (User)

or

User 1 = user

 

If use name is available in , we sometime use from the fact for display purpose

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.