Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stacking Two Expressions on the Same Bar in a Bar Graph

Hi QlikView Ninjas,

This seems like a pretty common scenario but I cannot seem to make it work in my graph. I have three data points Budget, Actuals and Forecast. On my bar graph I want to show Budget as it's own bar but Actuals and Forecast stacked together next to budget. Something like the image below. I tried two expressions, budget and forecast + actuals = gave me two bars but the second one wasn't stacked. I added an additional dimension but that didn't work either. Then I tried with three expressions but still can't get it to work. Any help would be greatly appreciated.

error loading image

1 Solution

Accepted Solutions
Not applicable
Author

Thanks for the quick responses. You got me thinking about the problem from a different angle. Here is how I solved the problem:

I reformat the data:

Council

Type

Budget

Actual

Forecast

SAM

Budget

1000

0

0

SAM

Act+Forecast

0

200

800

EIS

Budget

5000

0

0

EIS

Act+Forecate

0

3000

1500



Then I created a chart using Council and Type as dimensions. I used three expressions, sum(Budget), only(Actual), only(Forecast). Apparently the "only" function filters just the values I wanted. Resulting in the chart below:

View solution in original post

3 Replies
Not applicable
Author

You can achieve it with data well structured.

Try to have a file like this

Create a field metric with only 2 values, create a field forecast where is null for metric = Budget

Then create a bar stack bar chart with Metric as dimension and 2 expressions Sum(Value) , Sum(Forecast)

MoisMetricValueForecast
1Budget1000
1Actual7020
2Budget2000
2Actual200

50

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Basically, your problem is that you are trying to combine a Group Chart and a Stacked Chart, and it doesn't work together. So, you need to trick QlikView into treating it as a Stacked chart - 2 Dimensions, 1 Expression.

To achieve your goal, you need to create a dummy table with 2 fields, associated with each other:

Dimension1 Dimension2

Budget Budget

Fcst/Actual Fcst

Fcst/Actual Actual

In the expression, you'll need to validate the value of Dimension2 and use the appropriate formula.

Now, the first Dimension will cause creating of 2 separate bars, and the 2 values of the Second Dimension will make he bars stacked.

good luck!

Not applicable
Author

Thanks for the quick responses. You got me thinking about the problem from a different angle. Here is how I solved the problem:

I reformat the data:

Council

Type

Budget

Actual

Forecast

SAM

Budget

1000

0

0

SAM

Act+Forecast

0

200

800

EIS

Budget

5000

0

0

EIS

Act+Forecate

0

3000

1500



Then I created a chart using Council and Type as dimensions. I used three expressions, sum(Budget), only(Actual), only(Forecast). Apparently the "only" function filters just the values I wanted. Resulting in the chart below: