Forum Discussion
Helps sort BD and create data model
- Anonymous6 years ago
Hi Anonymous ,
First, make sure that a relationship based on the field [PV] is created between Table 1 and Table 2. Then, you can create a measure to get it as follows:
Cost of per kg = VAR _curpv = MAX ( 'Table 1'[PV] ) VAR _sumofcost = CALCULATE ( SUM ( 'Table 2'[costo] ), FILTER ( 'Table 2', 'Table 2'[PV] = _curpv ) ) RETURN DIVIDE ( _sumofcost, MAX ( 'Table 1'[Kilos] ) )If the above one can't get the correct value, please provide your expected result and the related calculation logic. Thank you.
Best Regards
Rena
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.
Hi Anonymous ,
First, make sure that a relationship based on the field [PV] is created between Table 1 and Table 2. Then, you can create a measure to get it as follows:
Cost of per kg =
VAR _curpv =
MAX ( 'Table 1'[PV] )
VAR _sumofcost =
CALCULATE (
SUM ( 'Table 2'[costo] ),
FILTER ( 'Table 2', 'Table 2'[PV] = _curpv )
)
RETURN
DIVIDE ( _sumofcost, MAX ( 'Table 1'[Kilos] ) )
If the above one can't get the correct value, please provide your expected result and the related calculation logic. Thank you.
Best Regards
Rena
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.