Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

ninnartx
Contributor

Comparing 2 alternate states in set analysis

Hi everyone,

I need some help with alternate states and set analysis.

The alternate state is set up in a way that users can select 2 different periods and see how much their sales increased or decreased, as seen from the picture attached.

Capture.JPG

However, I would like to be able to count the number of products in each category.

For example, decreased = 3, increased = 2.


So I'm a little stuck trying to incorporate alternate state, aggr, and set analysis together.

Could someone provide me with a guideline pls?

Thank you!!!

1 Solution

Accepted Solutions
MVP
MVP

Re: Comparing 2 alternate states in set analysis

For Decreased...

=SUM(Aggr(IF(sum({PeriodB<StoreCode =$::StoreCode>}SalesValue)-sum({PeriodA<StoreCode =$::StoreCode>}SalesValue)<0,1),Product))

For Increased..

=SUM(Aggr(IF(sum({PeriodB<StoreCode =$::StoreCode>}SalesValue)-sum({PeriodA<StoreCode =$::StoreCode>}SalesValue)>0,1),Product))

For No Change

=SUM(Aggr(IF(sum({PeriodB<StoreCode =$::StoreCode>}SalesValue)-sum({PeriodA<StoreCode =$::StoreCode>}SalesValue)=0,1),Product))

View solution in original post

5 Replies
MVP
MVP

Re: Comparing 2 alternate states in set analysis

Can you provide source data and how you have used alternate state here?

ninnartx
Contributor

Re: Comparing 2 alternate states in set analysis

Can't provide data source but basically

PeriodA sales = sum( {[PeriodA]<StoreCode =$::StoreCode>} SalesValue)

PeriodB sales = sum( {[PeriodB]<StoreCode =$::StoreCode>} SalesValue)

Diff = [PeriodB sales] - [PeriodA sales]

and there are 2 listboxes each for year and month assigned to Period A and B.

MVP
MVP

Re: Comparing 2 alternate states in set analysis

Where you want to display this?

However, I would like to be able to count the number of products in each category.

ninnartx
Contributor

Re: Comparing 2 alternate states in set analysis

in another text or chart (straight table) object.
Like at the top of the dashboard there will be 2 huge numbers that say
# of products which sales increased = 2

# of products which sales decreased = 3

MVP
MVP

Re: Comparing 2 alternate states in set analysis

For Decreased...

=SUM(Aggr(IF(sum({PeriodB<StoreCode =$::StoreCode>}SalesValue)-sum({PeriodA<StoreCode =$::StoreCode>}SalesValue)<0,1),Product))

For Increased..

=SUM(Aggr(IF(sum({PeriodB<StoreCode =$::StoreCode>}SalesValue)-sum({PeriodA<StoreCode =$::StoreCode>}SalesValue)>0,1),Product))

For No Change

=SUM(Aggr(IF(sum({PeriodB<StoreCode =$::StoreCode>}SalesValue)-sum({PeriodA<StoreCode =$::StoreCode>}SalesValue)=0,1),Product))

View solution in original post