Forum Discussion
Measure to Sum Joined Tables
- 6 years ago
Hi Anonymous ,
You don't need to sum it twice. Please refer to the following measure:
Measure = CALCULATE ( SUM ( Events[Duration] ), NATURALINNERJOIN ( 'Events', 'CustomerEvents' ) )
The relationships are already set up. They are 1-*, and only cross filter one direction for necessity. There are other relationships involved, so the actual calculate measure I am using has more to it than this, but I am currently using something like this:
measure =
calculate(
sumx(CustomerEvents,sum(Events[Duration]))
,crossfilter(CustomerEvents,Events,both)
)
This doesn't result in the correct answer. Here's why:
Sum(Events[Duration]) = 392
Countrows(CustomerEvents) = 38
sumx(CustomerEvents,sum(Events[Duration])) = 14,896
sumx(CustomerEvents,sumx(Events,[Duration])) = 14,896So what this is doing is giving me 392*38 as the answer, when that is not correct. I need the durations to be spread out / weighted by how many customers attended each event. The correct answer is 1,305 when calculated correctly using the join method above in SQL, but I can't get that to happen in PBI.
Hi Anonymous ,
You don't need to sum it twice. Please refer to the following measure:
Measure =
CALCULATE (
SUM ( Events[Duration] ),
NATURALINNERJOIN ( 'Events', 'CustomerEvents' )
)