Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

Counting a distinct with condition straight table columns

Customer_Code     Year 2016 accounts     year 2017 accounts     average purchases/customer code     growing/declining account    count


i wish to count the column of growing/declining accounts which have only growing and declining based on the averages.

=COUNT(DISTINCT(CUSTOMER_CODE)) gives me the total accounts which doesnt differentiate whether it is growing or declining

i can only get the differentiated number when i search for growing / declining in the table itself.


Thanks in advance

5 Replies

Re: Counting a distinct with condition straight table columns

Can you share few rows of data and explain what your expected output needs to be?

Not applicable

Re: Counting a distinct with condition straight table columns

Can you please explain it in detail. If possible share an example

Not applicable

Re: Counting a distinct with condition straight table columns

Untitled.png

(Growing/Declining Ac column)  =If(Num(Column(6))>num((Column(7))), 'Declining', 'Growing')

Re: Counting a distinct with condition straight table columns

What is your expression behind Column(6) and Column(7) here? You will need to do something like this

Declining Count

Sum(Aggr(If(ExpressionColumn6 > ExpressionColumn7, 1), CUSTOMER_CODE))

Growing Count

Sum(Aggr(If(ExpressionColumn6 <= ExpressionColumn7, 1), CUSTOMER_CODE))

Not applicable

Re: Counting a distinct with condition straight table columns

I've solved it by using =(Column(9)) and total mode changed to sum of rows. Thanks for all the help btw :3