
% of sales comparated with other product...
Sami Casab Oct 28, 2011 5:48 PM (in response to Sami Casab)In my sample I Have only one dimension but i need arround 5 more dimensions... I was trying something like this: aggr(sum({ $< Producto = {'Prod_2'} > } Cantidad ),Producto,Mes) and something like this: sum({ $< Producto = {'Prod_2'} > } TOTAL Cantidad ), the problem is that doesnt filter the content of the other dimensions...

% of sales comparated with other product...
Stefan Wühl Oct 29, 2011 7:55 AM (in response to Sami Casab)Try this for share of product's sum(Cantidad) compared to Prod_2:
=sum(Cantidad) / Sum(total<Mes> { $< Producto = {'Prod_2'} > } Cantidad)
If you add more dimensions, you need to add those also to the total fields (like total<Mes,AnotherField> )
Hope this helps,
Stefan

% of sales comparated with other product...
Sami Casab Oct 31, 2011 10:55 AM (in response to Stefan Wühl )Thank you very mouch for your help, I really appreciate it.



% of sales comparated with other product...
Sami Casab Oct 31, 2011 12:00 PM (in response to Sami Casab)Hi:
This solution has a strenge use, if I Collapse the dimension asociated to "Product2" all the calculations in other dimensions are null or 0, if i exapnd it then it works fine...
Do you have any idea to solve this?

% of sales comparated with other product...
Stefan Wühl Oct 31, 2011 12:30 PM (in response to Sami Casab)It seems that when you collapse the dimension, QV doesn't have the Mes values for that particular product2 anymore. Don't know why, sometimes I think it's really not well designed.
you could introduce advanced aggregation to overcome this, but then I don't get the subtotals right anymore.
So I came up with a solution which checks for dimensionality and uses either above expression with or without advanced aggegration (Maybe there is a much more simple solution, I don't know):
=if(dimensionality()>1,
aggr(sum(Cantidad) / Sum(total<Mes> { $< Producto = {'Prod_2'} > } Cantidad), Producto, Mes),
sum(Cantidad) / Sum(total<Mes> { $< Producto = {'Prod_2'} > } Cantidad)
)
The check for dimensionality was designed for the table you attached in your OP, if you add more dimensions, you might need to adjust for that.
Hope this helps,
Stefan
