Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stacked bar chart variant

Hi

I want to create a bar chart but i have three measures, two of which i want as a stacked bar chart and the other a straight bar chart

Example

Year     Budget     Expenditure     Commitments

2015     500000     200000            150000

So in a bar chart I want to see one bar with Budget 500000

In the Second Bar chart I want to see Expenditure and Commitments stacked on top of each other with a different color.for each

Is it possible to do this, or would I just need to create a bar for each?

21 Replies
jyothish8807
Master II
Master II

Hi Ander,

Yes we can do it.

Try creating  stacked chart and in expresion use "if condition".

for eg:

Dimension field contains: Budget,Exp,Commi.

Create two expression.

in first exp: write your actual values you want to display.

in second exp: say if(Dimension=Budget,sum(Sales),if(Dimension=exp,0)).

Now like this you can have both stacked and single bar in same chart.

Hope it helps.

Regards

KC

Best Regards,
KC
Not applicable
Author

Thanks, looks good, but i will have a look at this and advise

Not applicable
Author

Thanks, will have a look at this as well

avinashelite

Cool DataNibbler, if we have limited set of values in the Dimension this work perfectly fine

I feel if we have more values in the dimension and if we want it to be dynamic then we might think , thanks for the sample file

Anonymous
Not applicable
Author

please check the attached file

Not applicable
Author

Good way , but I prefer the other option by DataNibbler

datanibbler
Champion
Champion

Hi Avinash,

I don't quite get you. More values in the dimension should not be a problem in itself, but I don't quite understand what you mean with it being dynamic? Do you mean the dimension being dependent on some condition?

Best regards,

DataNibbler

avinashelite

My point is in order to get the stack we are writing this

= IF(Dim_2=1, Expr_1) , = IF(Dim_2=1, Expr_2) and = IF(Dim_2=2, Expr_3)

expression rite. so if a new value called 3 gets added for the Dim_2 dimension than? we need to add one more expression rite? this was my point

datanibbler
Champion
Champion

Hi Avinash,

sure! With one more value to that secondary dimension, I'm not sure what would happen or what we could do.

In fact, that secondary dimension is (in my example) not a functional part of anything, it's just a trick (and thus completely arbitrary and artificial) to enable the part_stacking_part_grouping of the expressions.

Best regards,

DataNibbler

Not applicable
Author

Hi

I have one question though. I understand exactly what you are doing. My issue though is I have the Dim2 Data in the same row as the Dim1 Data. I am just stuck finding my way around it. See attached summarised Data example