Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Test101
Contributor III
Contributor III

Stacked bar chart with target variance

Hello Everyone,

 

I have some sales and target data that I would like to convert into a stacked barchart as follows.

Test101_0-1589744310289.png

Here as you can see the red is the deficit when sales is compared to target while green is the surplus.

 

I was wondering how I could achieve this.Currently my sales vs target data in Qlik Sense looks like this.

Test101_1-1589744509244.png

for an alternate solution I found this article but it isn't what I really want - (https://www.quickintelligence.co.uk/qlik-target-bar-chart/)

 

Thank you

 

Labels (2)
3 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

the easiest way to achieve this will be to use combo chart 

you define the measures you need 

and set the ones you want to stack as bars representation 

and the one you want as line as marker 

 

Test101
Contributor III
Contributor III
Author

as  you can see in the original post I already am using combo chart. The challenge is to get the surplus/deficit area as colored area.

lironbaram
Partner - Master III
Partner - Master III

hi 

there is no challenge you need to use 3 expressions for the bars 

1. actual (up to target) - if(Sum(Actual)>sum(Target),sum(Target),sum(Actual))

2. surplus - if(Sum(Actual)>sum(Target),sum(Actual)-sum(Target),0)

3. deficit - if(Sum(Actual)>sum(Target),0,sum(Target)-sum(Actual))

that's it , it'll look like this 

Annotation 2020-05-18 121812.png