7 Replies Latest reply: Mar 22, 2011 7:02 AM by Günter Angerer

# Setting a condition for a chart

I apologize for raising such a basic problem, but I found no solution in the forums so far...

I would like to generate 5 charts that show average prices for 5 different sales departments. It works just fine to show the prices for all departments but I would like to "filter" the first chart to show only SalesDept = SD1, for chart number two SalesDept = SD2 etc. etc.

I played around with the conditions on the general tab of the chart but never got the desired result.

I would really appreciate some help here.

Many thanks
Günter

• ###### Setting a condition for a chart

Hi,

Have you tried a Set Analysis ?

• ###### Setting a condition for a chart

I have to admit that I have no clue of how this works as I just started off with Qlikview...

• ###### AW:Re: Setting a condition for a chart

Hi,

Example syntax of Set could be:

First Chart expression:

Avg({\$<SalesDept={'SD1'}>}Price)

Scnd Chart expression:

Avg({\$<SalesDept={'SD2'}>}Price)

and so on..

meaning:

{}<- outer means: start and end of set-analysis

\$= current selection (i.e. year, month and so on)

<> = values to pre-set in the set syntax

={} = inner: value-list to set (in this example the SalesDept)

HTH

• ###### AW:Re: Setting a condition for a chart

Thank you all for your kind replies!

I have currently selected as Dimension "Month" and as expression

Sum

([Revenue])/Sum ([Quantityinmtons]) which calculates my average revenue per ton per month. How would I include here the selection for the sales department. Sorry that I'm still completely lost...

I somehow have the feeling that my approach is completely wrong. I thought that there should be a way to calculate like above and to tell Qlikview "but select only SD1 in the field SalesDept.

Sum

({\$<SalesDept={"SD1"}>[Revenue]) / Sum ({\$<SalesDept={"SD1"}>[Quantityinmtons])

({\$<SalesDept={"SD1"}>[Revenue]) / Sum ({\$<SalesDept={"SD1"}>[Quantityinmtons])

({\$<SalesDept={"SD1"}>[Revenue]) / Sum ({\$<SalesDept={"SD1"}>[Quantityinmtons])

the above attempt did not work ;-((

Günter

• ###### AW:Re: Setting a condition for a chart

Update:

I think I found the correct way to write the expression:

Sum

({\$<SalesDept={SD1}>}Revenue)/Sum({\$<SalesDept={SD1}>}[Quantityinmtons])

Many thanks for all your input - still a long way for me to learn...

• ###### Setting a condition for a chart

Ok,

You can have a look on the help looking for Set Analysis, it's quite well explained. Basically this is something like Sum({\$<SalesDept = {"SD1"}>} Sales in the expression, that indicate that you keep the whole selection of your application except SalesDept which will be SD1 whatever the selection could be.

Another idea should be to use treillis chart, try to add SalesDept on your dimensions and to click this button.

• ###### Setting a condition for a chart

Hi angerer