Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stacked Bar Chart Issue

Attached is the sketch of the required bar chart. Along with the sample Excel file.

Looking for help in building this chart

1 Solution

Accepted Solutions
Not applicable
Author

no what I meant is lets say If I have another field called State and I want to use the same metrics for the filed of  'GA' for example

Something like

=Sum({<State={'GA'}>} Amount)

/

Sum({< State ={'GA'}> } TOTAL <Year> Amount)


its not working??

View solution in original post

23 Replies
sunny_talwar

I guess create a new field from Sales Date. -> Year([Sales Date]) as [Sales Year]



And then use Year as your 1st dimension and Sales Year as second dimension


Expression:

Sum(Amount)/Sum(TOTAL <Year> Amount)

Not applicable
Author

But if you look at the  sketch I need to group the previous 2 years as one block and anything older then 3 yrs as a seperate block

sunny_talwar

May be create a flag in the script:


If(Year = Year([Sales Date]) or Year = Year([Sales Date]) + 1, Year([Sales Date]), Dual('<=' & (Year -2), (Year - 2))) as [Sales Year]


And then then same two dimensions and try the same expression

Not applicable
Author

Can you please post a sample qvw

sunny_talwar

Like this:

Capture.PNG

Not applicable
Author

Yes exactly. can you pls post the QVW?

sunny_talwar

I did add it to my response above. Open the link here ->Re: Stacked Bar Chart Issue

Not applicable
Author

Got it, one last question.  I am still not able to do the 3 stacks, so if Year is 2016 I would like to see

Stack 1  Sale Year = Year

Stack 2  Sale Year = Year-1 and Year -2

Stack 3  Sale Year <= Year -3

All 3 stacks should add up to 100%

sunny_talwar

Above image is showing three stacks and they are adding up to 100%. Did you follow the similar logic in the script?