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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
eburke
Helper II
Helper II

Userelationship and Measures

Hi all,

 

Hoping someone can help, I've just worked out how to use the Userelationship function to allow me to link two tables multiple times.  I have a data table that has several date columns = Enquiry Date, Lead Date, Conversion Date.  I have linked all of these to my calendar with the Conversion date being the default and the other two being activated by a Userelationship, for example:

 

Enquiry Date = CALCULATE(COUNTA(Leads[EnquiryDate]),USERELATIONSHIP(Leads[EnquiryDate],'Work Calendar'[Date]))

 

My issue is that I also need to add a filter to this calculation and don't know how.  For example an enquiry is considered a call without an Active Code, so normally I would have a measure filtering all rows without a code and calling them Enquiries:

 

Enquiries = CALCULATE([All Calls],Leads[DateActiveReferralCodeReceivedByOfficer] = BLANK())

 

How do I essentially combine these so I can get a measure that filters the rows by whether or not they have an active code, yet at the same time applies the Userelationship so that the show correctly in a table by months?

 

Hope that makes sense.  Thanks

1 ACCEPTED SOLUTION

Ok I've had some success, looked at it from a different angle and did it in two steps.  Started with the measure that links the relationship so it will appear correctly in the month table:

 

Enquiry Date = CALCULATE(COUNTA(Leads[EnquiryDate]),USERELATIONSHIP(Leads[EnquiryDate],'Work Calendar'[Date]))

 

Then used this measure in the calculate to only look at calls without an approval date, rather than using the measure All Calls.

 

Enquiries = CALCULATE([Enquiry Date], Leads[DateActiveReferralCodeReceivedByOfficer] = BLANK())

 

This way I get the benefit of both calculations in the final measure.  Maybe not what is considered elegant programing but it works which is the most important thing for me at the moment.

 

Thanks everyone for your input.

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi @eburke,

 

Try this

 

=CALCULATE([All Calls],FILTER(Leads,ISBLANK(Leads[DateActiveReferralCodeReceivedByOfficer])),USERELATIONSHIP(Leads[EnquiryDate],'Work Calendar'[Date]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for your reply Ashish, unfortunately that gets the error message "Too many arguments were passed to the FILTER function. The maximum argument count for the function is 2."

Hi @eburke,

 

I just edited my formula in the previous reply.  Copy the revised formula.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

his came up with a blank result.  That's ok, I'll go with my two step approach, appreciate the help.

Ok I've had some success, looked at it from a different angle and did it in two steps.  Started with the measure that links the relationship so it will appear correctly in the month table:

 

Enquiry Date = CALCULATE(COUNTA(Leads[EnquiryDate]),USERELATIONSHIP(Leads[EnquiryDate],'Work Calendar'[Date]))

 

Then used this measure in the calculate to only look at calls without an approval date, rather than using the measure All Calls.

 

Enquiries = CALCULATE([Enquiry Date], Leads[DateActiveReferralCodeReceivedByOfficer] = BLANK())

 

This way I get the benefit of both calculations in the final measure.  Maybe not what is considered elegant programing but it works which is the most important thing for me at the moment.

 

Thanks everyone for your input.

Anonymous
Not applicable

What if you passed the Enquiry Date as a variable?

Enquiries = 

VAR _enquiryDate = CALCULATE(COUNTA(Leads[EnquiryDate]),USERELATIONSHIP(Leads[EnquiryDate],'Work Calendar'[Date]))

 

Return

CALCULATE(_enquiryDate, Leads[DateActiveReferralCodeReceivedByOfficer] = BLANK())

@eburke,

 

Since your problem has been resolved, please help accept solution. Your contribution is highly appreciated.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MattAllington
Community Champion
Community Champion

You can pass as many filters to calculate as you need. Just delete the last bracket in your first formula, then add your leads filter there



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Enquiry.PNG

 

Hi Matt, thanks for the answer, unfortunately this gets me a result saying 'False' instead of the number of enquiries per month.  Any idea where I'm going wrong here?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.