Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
May andbody explain to me the use of agg function.
maybe with a little sample.
Thxs,
Hi,
Thats right. The expressions with aggr may look a little confuse if you dont visualize it with a sample, but the concept is really simple.
Regards,
Cesar.
Hi,
lets say you have the following table:
Order ID | Item | Value |
---|---|---|
1 | A | 10 |
1 | B | 5 |
1 | C | 2 |
2 | A | 3 |
2 | D | 4 |
3 | B | 6 |
3 | E | 3 |
Then you want to know the average value by Order... if you just use an expression like avg(Value), the result will be the average by Item (4.71) and not by Order (11). So in this case you need to change the aggregation, and thats the purpose of the Aggr function.
In this case you could use something like:
avg(aggr(sum(Value), [Order ID]))
This expression means the average of the Values aggregated by Order ID.
Regards,
Cesar.
Hi,
thanks for the replay..
Would that mean the result will be:
1 (10+5+2)/3
2 (3+4)/2
3 (6+3)/2
Thxs,
Hi,
Thats right. The expressions with aggr may look a little confuse if you dont visualize it with a sample, but the concept is really simple.
Regards,
Cesar.
Thxs for the quick responses.
Hi Cesar,
I have small doubt after looking at the explanation which u have posted.The expression has to be the same as above.But if we use that in Bar char as the dimension if we use OrderID then what will be the result.Please clarify this doubt.
Regards,
Deepthi