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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Userelationship wrong result with a used column

Hello ,

 

I have issues with Userelationship function.

 

In fact I have two measures :

 

Total_Amount_Direct =
CALCULATE (
SUM (Fact1[money] );
DATESYTD( 'Date_Table'[Date] );
FILTER ( Dimension; Dimension[Filter_Column] = "Physical")
)

 

Total_Amount_UserRelationShip =
CALCULATE (
SUM (Fact2[Amount] );
DATESYTD( 'Date_Table'[Date] );
FILTER ( Dimension; Dimension[Filter_Column] = "Physical");
USERELATIONSHIP ( Fact2[ID]; Fact1[ID] )
)

This is the result :

Capture1.JPG

 

When I add the Filter Column to the table everything come wrong?

 

Is this the effect of the USERELATIONSHIP Function?

 

I need to add new Dimension ( copy of the existing Dimensio) to filter the table and have the good result?

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Repeating myself... Please never, ever, ever join 2 fact table directly to each other. This is one of the worst things you can do in data modeling. Please use the correct design patterns unless you want to suffer in the future. 2 fact tables must always be joined to common (conformed) dimensions and slicing can ONLY be performed via the attributes of the dimensions, never directly on the columns of the fact tables.

If you deflect from this golden rule, you'll very soon start creating numbers nobody will be able to understand, including you.

There are plenty of vids on YT that explain how to build correct models. Please watch them before you shoot yourself in the foot.

Best
D

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Difficult to say what the problem is with the information provided. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello Greg,

 

This is my Schema :

 

Capture14.JPG

 

 

I think when we want to across the dimension column returned from the USERELATIONSHIP then I cant see nothing as result 

 

I think it's a DAX Logic

Anonymous
Not applicable

Repeating myself... Please never, ever, ever join 2 fact table directly to each other. This is one of the worst things you can do in data modeling. Please use the correct design patterns unless you want to suffer in the future. 2 fact tables must always be joined to common (conformed) dimensions and slicing can ONLY be performed via the attributes of the dimensions, never directly on the columns of the fact tables.

If you deflect from this golden rule, you'll very soon start creating numbers nobody will be able to understand, including you.

There are plenty of vids on YT that explain how to build correct models. Please watch them before you shoot yourself in the foot.

Best
D
Anonymous
Not applicable

@Anonymous @Greg_Deckler 

The relation betwee my Fact tables is 1..1 

In fact I solve it but it looks strange :

 

I have 3 measures :

Total_Amount =
CALCULATE (
SUM ( 'Fact1'[Amount] );
DATESYTD ( 'Date'[Date] );
FILTER (Dimension; LEFT ( Dimension[Filter_Column]; 1 ) <> "5")
)


Total_Amount1 =
CALCULATE (
SUM ( 'Fact'[Amount] );
DATESYTD ( 'Date'[Date] );
FILTER (Dimension; LEFT ( Dimension[Filter_Column]; 1 ) <> "5");
USERELATIONSHIP ( 'Fact1'[ID]; 'Fact2'[ID] )
)


Total_Amount2 =
CALCULATE (
SUM ( 'Fact'[Amount] );
DATESYTD ( 'Date'[Date] );
CALCULATETABLE (
SUMMARIZE (
Dimension;
Dimension[Dim_ID];
Dimension[Filter_Column]
);
FILTER ( Dimension; LEFT ( Dimension[Filter_Column]; 1 ) <> "5" )
);
USERELATIONSHIP ( 'Fact1'[ID]; 'Fact2'[ID] )
)

 

Relation between Fact1 and Fact2

1..*

Relation between Fact1 and Dimension

*..1

Column 1 and Column 2 are from Fact1 Table

There is no relation betwenn Fact 2 and Dimension .
There is no relation between Fact2 and Column 1 and Column 2 (we need to use the USERELATIONSHIP )

 

Result as follows:

 

bizar.JPG

The result is ok for the third measure using the CalculateTable, but I didn't Understand why the second Measure did not work !

 

Can Someone explain to me?

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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