# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Talk to Experts Tuesday, Live Q&A, September 22: Moving from QlikView to Qlik Sense. REGISTER
cancel
Showing results for
Did you mean:
Highlighted
Contributor III

## Problem AGGR with condition

Hi,

I have a Problem with a 'aggr' formula.

I want to count all the customer with sales > 0.

In my example this will be 75 (count({< CustID = {"=sum(Sales) > 0"}>}CustID)) for store 0592.

All customers are 78  (Count CUSTID)) for 0592

(as you can see in the pic & Excel-File).

Now I want a list of all my stores (counted by store and market).

When I selected the store 0592 I will get 75.

aggr( count( {< CUSTID= {"=sum(Sales) > 0"}>}CustID),  Store, Market )

But if de-select the store and all my stores are shown, I will get the result 78 for the store 0592.

What I need to change that even in that overall list it will be 75?

Can someone pls. help me?

Best Regards

Markus

1 Solution

Accepted Solutions
Highlighted
Specialist

I think I figured out the issue, Markus. Try this expression

Sum(If(Aggr(sum(Sales), Market, Store, [Cust ID] ) > 0, 1))

7 Replies
Highlighted
MVP & Luminary

Hi,

Try normal expression which you used earlier. i.e.

(count({< CustID = {"=sum(Sales) > 0"}>}CustID))

Just add Market as dimension along with Store.

Regards,

Kaushik Solanki

Regards,
Kaushik
Highlighted
Contributor III

Hi Kaushik,

no Change.

Markus

Highlighted
MVP & Luminary

Hi,

Can you share full data. (I am unable to replicate the issue with given data)

Regards,

Kaushik Solanki

Regards,
Kaushik
Highlighted
Specialist

Hi, Markus. I think there must be something else, I made a sample with your data and expressions... and got no error

Highlighted
Contributor III

Hi Andrey,

I found the the Problem.

As you can see there is 1 cutomer who got sales in 2 stores (1 is negative and 1 is positive).

I need to know if the customer in one store is >0 (not in General).

The last column /formula in the 2nd row is not correct.

Can anyone help me with that?

aggr( count({< [Cust ID] = {"=sum(Sales)>0"}>}[Cust ID]),  Market, Store)

Best Regards

Markus

Highlighted
Specialist

I think I figured out the issue, Markus. Try this expression

Sum(If(Aggr(sum(Sales), Market, Store, [Cust ID] ) > 0, 1))

Highlighted
Contributor III

Hi Andrey,

Yes. Perfect. Thank you very much.

Regards

Markus