Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dears,
Can you advice on this calculation , what is wrong
=Sum(sum(
Sum(ACT_QTY_CLOSE) * Sum(UNIT_EQUIVALENCE))
+
Sum((Sum(ACT_QTY_OPEN) *Sum(UNIT_EQUIVALENCE)) + (sum(ITEM_QUANTITY_PUR * ITEM_PURCHASE_EQUIVALENCE) * Sum(UNIT_EQUIVALENCE)))
-
Sum((sum(ITEM_CONSUMPTION)* Sum(UNIT_EQUIVALENCE)) + Sum(WASTAGES))
* ITEM_PURCHASE_PRICE)
any help please.
Message was edited by: Ahmad Kastero
It's not possible to nest aggregations without an AGGR...
- Marcus
Hi Marcus,
i try to do it wit Aggr but it is not work ,
i try with the main field that i need to do the calculation on it (%Cons_Item_Key) .
is there is another way or only we can do it by using AGGR.
Hi Ahmad, maybe using RangeSum:
RangeSum(
RangeSum(Sum(ACT_QTY_CLOSE) * Sum(UNIT_EQUIVALENCE))),
RangeSum(Sum(ACT_QTY_OPEN) *Sum(UNIT_EQUIVALENCE),
sum(ITEM_QUANTITY_PUR * ITEM_PURCHASE_EQUIVALENCE) * Sum(UNIT_EQUIVALENCE))
-RangeSum(sum(ITEM_CONSUMPTION)* Sum(UNIT_EQUIVALENCE),
Sum(WASTAGES))
) * ITEM_PURCHASE_PRICE)
Not tested, maybe there is a typo... and I never used RangeSum this way, so I'm not sure if this can work.
Thank you Ruben, but unfortunately not working .
If you could logically replace the sum() around the sum(Fields) with a + than you could go with the approach from Ruben otherwise you will need the aggr() with the proper dimensions to those parts where you couldn't replace them.
- Marcus
Do it step by step and give each part a single expression and if they work like expected put them together and check again.
- Marcus
I did it more simpler and worked but, as I said, I'm not sure if that complexity can work (I don't see why not).
And also it was written directly in the post, so typo's may appear, rigth now I saw a lack of a comma:
Sum(UNIT_EQUIVALENCE)), //This comma was forgotten in my previous post
Dears,
i add a sample for my target bar chart and my reference value in table ( Recipe Consumption) if you see in this table the last column is the VALUED DIFFERENCE this column result of all that nested sum but when i try to do it in bar chart i can't.
i need to see for each item the total of VALUED DIFFERENCE in bar chart even (Positive or Negative value). this is my target.
Hi Ahmad, the expression 'Theo.Cons.Recipe Qty' is a conditional expression, when the condition is false the expression is not calculated, so every other expression that uses this expression can't be calculated.
You can transform the null in 0 using Alt(): Alt([Theo.Cons.Recipe Qty],0), but the deference% will also return null (it will be a division by zero).
If what you want is to hide this column but still use the values use the conditional show in the presentation tab instead of the conditional expression of the expression tab.
And the VALUE difference column can't be calculated that way because it has many different values for ITEM_PURCHASE_PRICE, it should be only one value (using an expressiont hat returns that value) or using aggr() so it uses different ITEM_PURCHASE_PRICE for each Aggr() dimension value... but I think this wouldn't be fit the intention of the expression so you need to kwon what to do with all the different ITEM_PURCHASE_PRICE... wich value has to be used in VALUE DIFFERENCE?