Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
NorrinRadd
Contributor
Contributor

Aggregation in stacked bar chart

Hi all,

I have the following stacked bar chart and want to display a running sum in each month :

NorrinRadd_2-1601049813630.png

So for example in Dec-19 I would want

LR7D = 58 + 7

LR30D = 58 + 7 + 9

The formaul used in the stacked bar chart is:

Pick(Only({1} VIZ_PeriodId)
,//1:
Sum({<RelativeYear={'-2'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeYear={'-2'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//2: Last Year
Sum({<RelativeYear={'-1'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeYear={'-1'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//3: YTD
Sum({<IsYTD={'Yes'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<IsYTD={'Yes'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//4:
Sum({<RelativeMonth={'-12'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-12'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//5:
Sum({<RelativeMonth={'-11'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-11'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//6:
Sum({<RelativeMonth={'-10'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-10'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//7:
Sum({<RelativeMonth={'-9'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-9'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//8:
Sum({<RelativeMonth={'-8'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-8'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//9:
Sum({<RelativeMonth={'-7'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-7'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//10:
Sum({<RelativeMonth={'-6'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-6'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//19:
Sum({<RelativeMonth={'-5'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-5'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//12:
Sum({<RelativeMonth={'-4'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-4'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//13:
Sum({<RelativeMonth={'-3'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-3'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//14:
Sum({<RelativeMonth={'-2'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-2'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))
,//15:
Sum({<RelativeMonth={'-1'},CanonicalType={'SupplyContractStartDate'}>} (TOTAL_CONTRACT_MARGIN))/Sum({<RelativeMonth={'-1'},CanonicalType={'SupplyContractStartDate'}>} TOTAL (TOTAL_CONTRACT_MARGIN))

)

 

I've tried used the the accumulation modifer on this measure but it sems to only aggregate the first two stacks..

NorrinRadd_3-1601050101471.png

I've also tried using RangeSum in the formaula of the measure with some strange results..

 

Any pointers greatly appreciated..

 

Thanks

 

1 Reply
sunny_talwar
MVP
MVP

@NorrinRadd would you be able to share a sample file where we can see the issue?