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

How to compare multiple selected values of a field

Hello,

I'll try to explain my data situation:

I load data from a database with some description fields, a year field, a month field and a quantity field.
Let's call 'em DESCRIPTION, YEAR, MONTH, QUANTITY

I also loaded year and month fields as SELECTION_YEAR_1, SELECTION_MONTH_1 and SELECTION_YEAR_2, SELECTION_MONTH_2.

User can select some months and some years to compare the sold quantity in different periods (with the selection 1 and 2).

I created a table and got the correct heading using the function GetFieldSelections() but I can't find the correct function to obtain the sum of all the quantity in a selected period.

It works fine if I select only a year and a month but the application crashes if I select more values for a field.

Suppose user selects Month: Jan and Apr, Year: 2012, how can I calculate the sum of all quantities from Jan and Apr 2012 ??


Thanks





1 Solution

Accepted Solutions
Gysbert_Wassenaar

If you're using QV11 you can try using alternate states. That's a lot simpler and more robust than working with data islands.

There's an example in the What's New in Qlikview 11 demo on the Product Grouping tab that demos product group comparison in a bar chart. You can find that example in the examples directory in your Qlikview installation: C:\Program Files\QlikView\Examples\Documents\Whats New in QlikView11.qvw.

And you can find a helpful document here: Why Comparative Analysis - Technical Brief.pdf


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

If you're using QV11 you can try using alternate states. That's a lot simpler and more robust than working with data islands.

There's an example in the What's New in Qlikview 11 demo on the Product Grouping tab that demos product group comparison in a bar chart. You can find that example in the examples directory in your Qlikview installation: C:\Program Files\QlikView\Examples\Documents\Whats New in QlikView11.qvw.

And you can find a helpful document here: Why Comparative Analysis - Technical Brief.pdf


talk is cheap, supply exceeds demand
Yousef_Amarneh
Partner - Creator III
Partner - Creator III

ignore other selections by using set expression like this sum({$<DESCRIPTION=>} QUANTITY)

Yousef Amarneh
Not applicable
Author

Set Analysis are the right answer. The example in the pdf document doesn't fit exactly my case, but reading all the Set Analisy section in the Qlick helpguide, I found the answer.
I post it here if anyone else need an example

sum({$<[Year]=P({[My set 1]}[Year]), [Month]=P({[My set 1]}[Month])>}[Quantity])