Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone
I'd need some help with the following expression. I need to select some products and then calculate the percentage of sales based on the current selection --> sales of selected products / Total sales of selected product lines. Nothing difficult. But every product belongs to a different product line.
product 1 --> product line 1
product 2 --> product line 2
product 3 --> product line 3
So, if I select only product 1 and product 2, I'd need in the denominator only the total of product line 1 and product line 2.
Formula: sum({$<year={2019}>} [quantity product]) / sum({<year={2019}, Product=>} total [quantity product]) doesn't work because it returns to me a denominator with ALL the values including the product line 3.
Is there anyone that can help me?
Thanks a lot in advance!
May be this
Sum({$<year = {2019}>} [quantity product])
/
Sum({$<year = {2019}, Product, ProductLine = p(ProductLine)>} [quantity product])
Or this if you are doing this in a chart where ProductLine is a dimension
Sum({$<year = {2019}>} [quantity product])
/
Sum({$<year = {2019}, Product, ProductLine = p(ProductLine)>} TOTAL <ProductLine> [quantity product])
May be this
Sum({$<year = {2019}>} [quantity product])
/
Sum({$<year = {2019}, Product, ProductLine = p(ProductLine)>} [quantity product])
Or this if you are doing this in a chart where ProductLine is a dimension
Sum({$<year = {2019}>} [quantity product])
/
Sum({$<year = {2019}, Product, ProductLine = p(ProductLine)>} TOTAL <ProductLine> [quantity product])
it worked perfectly.
Thanks a lot!