Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

1 Solution

Accepted Solutions
Not applicable
Author

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...

View solution in original post

7 Replies
Not applicable
Author

Hi,

Have you tried a Set Analysis ?

Not applicable
Author

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

Not applicable
Author

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

Not applicable
Author

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.

ashfaq_haseeb
Champion III
Champion III

Hi angerer

In order to start with Set Analysis.

Just go throught the document attached

I think this would be a great start

Regards

ASHFAQ

Not applicable
Author

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

Not applicable
Author

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...