Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to get the proportions for each age group to add up to 100% in each year in the following bar chart -
The expression I am using is -
SUM(sales)/SUM(TOTAL(sales))
But it's not working.
Can anyone help?
Thanks
Greg
Put the name of your year dimension in <, > brackets after the total keyword:
SUM(sales)/SUM(TOTAL <...YourYearDimensionHere...> sales)
Put the name of your year dimension in <, > brackets after the total keyword:
SUM(sales)/SUM(TOTAL <...YourYearDimensionHere...> sales)
Hi Greg,
You Current Scenario:
1. Dimension: Year
2. Dimension: AgeGroup
3. Expression: Sum(Sales)
As per your requirement, you have to use:
1. Dimension: Year
2. Expression: Sum({<AgeGroup = {"Age Under 16"}>}Sales)
3 Expression: Sum({<AgeGroup = {"Age 16-19"}>}Sales)
4. Expression: Sum({<AgeGroup = {"Age 20-24"}>}Sales)
5. Expression: Sum({<AgeGroup = {"Age 25 and over"}>}Sales)
Please apply and revert. Hope this helps
Warm Regards
Rahul
Thanks Gysbert.
On a similar issue, I have highlighted two of the age groups in the following line chart and I am trying to show the proportions for each year.
I've tried adding the <Year> in the following expression but it is not working -
Sum({$<age_group1={'B. age 16-19'}>}(sales))/Sum({$<age_group1={'A. age Under 16','B. age 16-19','c. age 20-24','d. age 25 and over'}>}(<YEAR> sales))
Do you know where I'm going wrong?
Thanks
Greg
Your expression is missing the total keyword.
I tried this but it dosnt work -
Sum({$<age_group1={'c. age 20-24'}>}(sales))/Sum({$<age_group1={'A. age Under 16','B. age 16-19','c. age 20-24','d. age 25 and over'}>}TOTAL(<Year> sales))
remove the parentheses around <Year> sales:
Sum({$<age_group1={'c. age 20-24'}>}sales)/Sum({$<age_group1={'A. age Under 16','B. age 16-19','c. age 20-24','d. age 25 and over'}>}TOTAL <Year> sales)
Perfect!. Thank you very much.
Greg