I have a virtual column [Related childs] with the formula REF_ROWS("Childs", "Parent ID").
The Childs table has a virtual column that calculates the total for each row called [total price]
I want to use the sum() function to sum the [total price] of the all the childs records of the parent record
if i use sum([Related childs][total price]) the result that it gives is wrong.
if I use sum(select(Childs[total price], [_thisrow].[Parent ID]=[Parent ID])) it works.
How is this different? Why is giving different answers?
Those should be the same.
Is the [Related...] the system-generated VC, and have you modified it in any way? Does it produce the same list of key value, or list of [total price] values, as the equivalent SELECT expression does?
Where are you writing this new SUM expression?
"Is the [Related...] the system-generated VC, and have you modified it in any way?"
yes it is, and I have not modified it in any way.
"Does it produce the same list of key value, or list of [total price] values, as the equivalent SELECT expression does?"
It should. If I create a inline view for this related records and I set the group aggregate to sum the totals it shows the correct value (the one using correct) and the number of items that it contains are the same.
sum(select(Childs[total price],
[_thisrow].[Parent ID] = [Parent ID]))
User | Count |
---|---|
44 | |
31 | |
29 | |
14 | |
14 |