Qlik Community

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 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Count number of conditions

Hi Everyone,

I am having some problems to get the next data:

I have a shop with three registers, In two of thems A is bigger than B and in one of them no. What I want to do is a sum of the number of registers where A is bigger (2). The thing is that if I have the dimension date (dia) selected it does the sum correctly  2.

Dimension.PNG.png

However, when I Delete the dimension date, which I do not want to show, it gives me 0 and no 2, which is the figure wchich I am searching for.

withoutdimension.PNG.png

Thank you.

Best regards.

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

sum(if(aggr(sum(a)-sum(b),shop,dia)>0,1,0))

View solution in original post

5 Replies
Highlighted

It is because the dia field split your data into different rows, if you want the same result you have to aggr by shop and dia

Highlighted
Not applicable

when aggregating =if(A>b,aggr(count(shop),dia,0)) it gives me a hyphen.

Thank you Alessandro.

Highlighted
MVP
MVP

sum(if(aggr(sum(a)-sum(b),shop,dia)>0,1,0))

View solution in original post

Highlighted
Not applicable

Thank you so much Massimo, It is perfect as you write.

Highlighted
MVP
MVP

When you think you get the answer, please close this discussion by giving Correct and Helpful answers to the posts which are useful for you.  It helps others in finding answers for similar scenarios. Thanks and good Qlik.