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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

USERELATIONSHIP not working as expected

Hello,

I have two tables (well, I have a lot more than two tables, but these are the two in question!  They are both related to tables other than each other, so it may be that the other relationships are part of the problem).

 

They are:

Payments - a fact table containing a row for every payment we have received from customers, and

Projects - a fact table containing a row for every project we are doing for customers.

 

There is no direct relationship between these tables, but they are indirectly linked via two paths.   

One path is:  Projects <-- TableA  <-- TableB --> Payments.

The other path is: Projects <-- TableA ---> TableC --> Payments

 

Both tables contain the columns PaymentCode (which describes the type of project, and should be unique within a customer's record as a customer cannot do the same type of project twice), and CustomerID.  I am trying to analyse how much customers spend on their projects, e.g. on average.

 

I have created a matching field on both tables called PaymentProjectLink, which concatenates the PaymentCode and the CustomerID, with a hyphen in the middle.  I had expected the PaymentProjectLink to be unique on the Projects table and not unique on the Payments table, as a customer typically makes multiple payments per project.  However, it turns out that the Projects table has a few duplicate project bookings which (for other reasons) I will not be removing, which means that there are duplicates in the ProjectCode field.  This is not a big problem for me, as the duplicates are for old projects that won't form part of my analysis.

 

I created a calculated column in Projects: 

ProjectTotal = CALCULATE([SumPaymentAmount],USERELATIONSHIP(Projects[PaymentProjectLink],Payments[PaymentProjectLink]))
 
(The measure [SumPaymentAmount] just sums up the amount from the Payments table - it normally works fine)
 
However, the ProjectTotal calculated column is not bringing me the totals I expected.  It is pulling through some payment data for some customers, but this seems to be based on another relationship.  The relationship it's using is that which connects TableX --> TableC.
 
I suspect all the relationships and paths are the problem... any advice?  Many thanks in advance.
 
P.S. My organisation does not permit me to upload a Power BI file to this forum, so I'm afraid I can't do that.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks both.  In the end, I created a workaround with a calculated table.  You are right, the relationships are complex and even a screenshot wouldn't cover them all!  I need to streamline that dataset one of these days.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks both.  In the end, I created a workaround with a calculated table.  You are right, the relationships are complex and even a screenshot wouldn't cover them all!  I need to streamline that dataset one of these days.

v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

Without similar data model or screenshot information, it is difficult to carry out a one-step test. You can provide some information or test data according to the prompts in the following link.

 

How to Get Your Question Answered Quickly - Microsoft Power BI Community


Looking forward to your reply.


Best Regards,
Henry

 

AlexisOlson
Super User
Super User

This is pretty hard to visualize. Can you include a screenshot of your relationship diagram?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors