Forum Discussion
NotebookEnjoyer
4 months agoAdvocate II
USERELATIONSHIP problems with n:m-relationship
Hello everyone, I have an arrangement as follows: Therein, the following measure unfortunately yields blank values: Sum by inactive Relationship = SUMX( VALUES('Fact_2'[Key_F2]), ...
- 4 months ago
Try this:
Sum F1 by F2 := CALCULATE( SUM('Fact_1'[Value_F1]), TREATAS( VALUES('Fact_2'[Key_D1]), 'Fact_1'[Key_D1] ), REMOVEFILTERS('Map1') )
johnt75
4 months agoSuper User
I don't think that that is the problem.
Can you create a measure like
Test Sum =
SUMX ( 'Fact_2', CALCULATE ( SUM ( 'Fact_1'[Value_F1] ) ) )
and put that into a table / matrix with 'Fact_2'[Key_D1]. This isn't using the inactive relationship at all so should tell us if the active relationships are working as intended.
NotebookEnjoyer
4 months agoAdvocate II
In short, it works. (In long, I have to add a filter because for each entry there is each one positive and negative entry, canceling each other out, and I have left out of my model the dimension table by which this is filtered. But it works.)
- johnt754 months agoSuper User
Try
Sum by inactive Relationship = VAR _Keys = CALCULATETABLE ( VALUES ( 'Fact_2'[Key_F2] ), USERELATIONSHIP ( 'Dim_1'[Key_D1], 'Fact_2'[Key_D1] ) ) VAR Result = CALCULATE ( SUM ( 'Fact_1'[Value_F1] ), TREATAS ( _Keys, 'Fact_1'[Key_F2] ) ) RETURN Result