Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

leroboy1980
New Contributor

100% barchart

Hello community,

I would like to make a 100% stacked bar chart.

Can someone help me with this?

now I get this.

I use 1 dimension and 2 measure.

(Count(if(Doorlooptijd<2,ID))/Count(ID))

(Count(if(Doorlooptijd>2,ID))/Count(ID))

Thanks

1 Solution

Accepted Solutions
niclaz79
Contributor III

Re: 100% barchart

Hi,

Try this to ensure that the TOTAL still takes into account the dimension:

(Count(if(Doorlooptijd<2,ID))/Count(TOTAL <DATUM_ERF.Week>  if(Doorlooptijd<>2,ID))

(Count(if(Doorlooptijd>2,ID))/Count(TOTAL <DATUM_ERF.Week> if(Doorlooptijd<>2,ID))

If it's still off, can you provide a qvw with the data so we can tinker with it? It's hard to find what goes wrong without seeing the background data.

4 Replies
niclaz79
Contributor III

Re: 100% barchart

Hi,

You have to have each value represent the percentage of the total for the week in order to make it work properly.

(Count(if(Doorlooptijd<2,ID))/Count(TOTAL ID))

(Count(if(Doorlooptijd>2,ID))/Count(TOTAL ID))

The below would get you closer to your goal, however you are missing the instance in which Doorlooptijd = 2. Should one of your if-statements include that?

Otherwise you need to use

(Count(if(Doorlooptijd<2,ID))/Count(TOTAL if(Doorlooptijd<>2,ID))

(Count(if(Doorlooptijd>2,ID))/Count(TOTAL f(Doorlooptijd<>2,ID))

leroboy1980
New Contributor

Re: 100% barchart

Hi Niclas,

Thx but these formulas returns me this chart.

niclaz79
Contributor III

Re: 100% barchart

Hi,

Try this to ensure that the TOTAL still takes into account the dimension:

(Count(if(Doorlooptijd<2,ID))/Count(TOTAL <DATUM_ERF.Week>  if(Doorlooptijd<>2,ID))

(Count(if(Doorlooptijd>2,ID))/Count(TOTAL <DATUM_ERF.Week> if(Doorlooptijd<>2,ID))

If it's still off, can you provide a qvw with the data so we can tinker with it? It's hard to find what goes wrong without seeing the background data.

leroboy1980
New Contributor

Re: 100% barchart

Thx

It worked

Community Browser