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') )
techies
4 months agoSuper User
Hi NotebookEnjoyer please try this
Sum by inactive Relationship = VAR _CurrentKey = SELECTEDVALUE ( 'Dim_1'[Key_D1] )
VAR _Keys =
CALCULATETABLE (
VALUES ( 'Fact_2'[Key_F2] ),
TREATAS ( { _CurrentKey }, 'Fact_2'[Key_D1] )
)
VAR Result =
CALCULATE (
SUM ( 'Fact_1'[Value_F1] ),
TREATAS ( _Keys, 'Map1'[Key_F2] )
)
RETURN
Result
- NotebookEnjoyer4 months agoAdvocate II
It's not quite there yet. It doesn't differentiate by the dimension and gives double the correct sum. I'm working on it.