Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
timbatman
Contributor
Contributor

Combined Stacked and Grouped Bar Chart

I have four variables of interest:

Q1CompCost, Q1WaterCost, Q2CompCost, Q2WaterCost

I wanted a stacked bar chart by quarter, but I can seem to only get all 4 variables to stack or all 4 to be side by side.  Any ideas?

Labels (1)
1 Solution

Accepted Solutions
Claudiu_Anghelescu
Specialist
Specialist

if not works you can try also this:

 

Dimension:

=valuelist('Q1', 'Q2') 

 

Expression Q1:

=if(valuelist('Q1', 'Q2') ='Q1',
sum(Q1CompCost))

Expression Q1:

=if(valuelist('Q1', 'Q2') ='Q1',
sum(Q1WaterCost))

 

Expression Q2:

=if(valuelist('Q1', 'Q2') ='Q2',
sum(Q2CompCost))

Expression Q2:

=if(valuelist('Q1', 'Q2') ='Q12,
sum(Q2WaterCost))

 

...and use the same color for each measure.

To help community find solutions, please don't forget to mark as correct.

View solution in original post

3 Replies
Claudiu_Anghelescu
Specialist
Specialist

Dimension1:

=valuelist('Q1CompCost', 'Q1WaterCost') 

 

Dimension2:

=valuelist('Q2CompCost', 'Q2WaterCost')

 

Expression Q1:

=if(valuelist('Q1CompCost', 'Q1WaterCost') ='Q1CompCost',
sum(expr))

Expression Q1:

=if(valuelist('Q1CompCost', 'Q1WaterCost') ='Q1WaterCost',
sum(expr))

 

Expression Q2:

=if(valuelist('Q2CompCost', 'Q2WaterCost') ='Q2CompCost',
sum(expr))

Expression Q2:

=if(valuelist('Q2CompCost', 'Q2WaterCost') ='Q2WaterCost',
sum(expr))

 

Put the same name for both expressions in each Quarter: Q1 and Q2 for example

 

To help community find solutions, please don't forget to mark as correct.
Claudiu_Anghelescu
Specialist
Specialist

if not works you can try also this:

 

Dimension:

=valuelist('Q1', 'Q2') 

 

Expression Q1:

=if(valuelist('Q1', 'Q2') ='Q1',
sum(Q1CompCost))

Expression Q1:

=if(valuelist('Q1', 'Q2') ='Q1',
sum(Q1WaterCost))

 

Expression Q2:

=if(valuelist('Q1', 'Q2') ='Q2',
sum(Q2CompCost))

Expression Q2:

=if(valuelist('Q1', 'Q2') ='Q12,
sum(Q2WaterCost))

 

...and use the same color for each measure.

To help community find solutions, please don't forget to mark as correct.
timbatman
Contributor
Contributor
Author

Thank you, worked perfectly.