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
bhmiller89
Helper V
Helper V

USERELATIONSHIP Function

I have two tables, one lists "UserID" and other lists "TechMgrID," "CustServiceRepID," and "PMMgrID"

 

I have a third table that lists "CreatedByUserID," which I also created a relationship to "UserID"

 

I need to calculate how many "Notes" were created by the CustServiceRep, the TechMgr, and the PMMgr.

Capture.JPG

 I tried

 

COL Notes = CALCULATE(COUNTA('dpmgr tblContactNotes'[Note]), 'dpmgr tblContactNotes'[IsSystem] = 0, 'dpmgr tblContactNotes'[IsAuto]= 0, USERELATIONSHIP('dpmgr tblContacts'[CustServiceRepID], 'dpmgr vwJMWebUsersSystemALL'[UserID]))

 

and changed the formula accordingly, but I don't think I'm getting the result I need.  I need the count of how many notes were entered by each role

 

 

5 REPLIES 5
bhmiller89
Helper V
Helper V

I have two tables, one lists "UserID" and other lists "TechMgrID," "CustServiceRepID," and "PMMgrID"

 

I have a third table that lists "CreatedByUserID," which I also created a relationship to "UserID"

 

I need to calculate how many "Notes" were created by the CustServiceRep, the TechMgr, and the PMMgr.

 

 

 

I tried

 

COL Notes = CALCULATE(COUNTA('dpmgr tblContactNotes'[Note]), 'dpmgr tblContactNotes'[IsSystem] = 0, 'dpmgr tblContactNotes'[IsAuto]= 0, USERELATIONSHIP('dpmgr tblContacts'[CustServiceRepID], 'dpmgr vwJMWebUsersSystemALL'[UserID]))

 

and changed the formula accordingly, but I don't think I'm getting the result I need.  I need the count of how many notes were entered by each role

 

 

Cool,

 

According to your formula it will give u the Count of Notes from CustServiceRepID and UserID relationship.

 

1. when u use userelationship , other relationshiop on the table is disconnected automatically.

 

2. If u want the count of ALL note from the Existing three connection. u have to calculated at three level like 

 

Measure =

Var CustServiceRepID = CALCULATE(COUNTA('dpmgr tblContactNotes'[Note]), 'dpmgr tblContactNotes'[IsSystem] = 0, 'dpmgr tblContactNotes'[IsAuto]= 0, USERELATIONSHIP('dpmgr tblContacts'[CustServiceRepID], 'dpmgr vwJMWebUsersSystemALL'[UserID]))

 

Var PMMgrID = CALCULATE(COUNTA('dpmgr tblContactNotes'[Note]), 'dpmgr tblContactNotes'[IsSystem] = 0, 'dpmgr tblContactNotes'[IsAuto]= 0, USERELATIONSHIP('dpmgr tblContacts'[PMMgrID ], 'dpmgr vwJMWebUsersSystemALL'[UserID]))

 

var CreatedByUserID = CALCULATE(COUNTA('dpmgr tblContactNotes'[Note]), 'dpmgr tblContactNotes'[IsSystem] = 0, 'dpmgr tblContactNotes'[IsAuto]= 0)

 

Result = CustServiceRepID  + PMMgrID + CreatedByUserID 

 

Let me know if any help

Anonymous
Not applicable

Worked for me , thank you !

@Baskar

 

These are the formulas I used, but they seem to be giving the same data and not correct data. They're all identical

 

Capture.JPG

 

 

Hi @bhmiller89,

 

If you want know how to use userelationship function, you can refer to Marco Russo's article:

 

userelationship-in-calculated-columns

 

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.