Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ltc
Partner - Creator
Partner - Creator

If Count Expression

Hello!

I don't know what I'm doing wrong with the following expression.  I'm probably not using the parenthesis correctly.  I've used this exact expression before, just without the count portion.

This time, I'm adding the count portion to the expression.  If a [filename] has a count of 0-10, then '0-10 Times', etc.

Please help me fix this:

=

If(count[filename]<=10,Dual('0-10 Times',0),

If(count[filename]>10 and count[filename] <=30,Dual('11-30 Times',1),

If(count[filename]>30 and count[filename] <=50,Dual('31-50 Times',2),

If(count[filename]>50,Dual('50+ Times',3),

))))

12 Replies
sunny_talwar

Would you be able to share a sample where we can see the issue?

sunny_talwar

Also, you might be able to try this and see if this works

=Aggr(

  If(count({1} [filename]) <= 10, Dual('0-10 Times', 0),

  If(count({1} [filename]) > 10 and count({1} [filename]) <= 30, Dual('11-30 Times', 1),

  If(count({1} [filename]) > 30 and count({1} [filename]) <= 50, Dual('31-50 Times', 2),

  If(count({1} [filename]) > 50, Dual('50+ Times', 3)))))

, [filename])

or

=Aggr(

  If(count({1<[filename] = p([filename])>} [filename]) <= 10, Dual('0-10 Times', 0),

  If(count({1<[filename] = p([filename])>} [filename]) > 10 and count({1<[filename] = p([filename])>} [filename]) <= 30, Dual('11-30 Times', 1),

  If(count({1<[filename] = p([filename])>} [filename]) > 30 and count({1<[filename] = p([filename])>} [filename]) <= 50, Dual('31-50 Times', 2),

  If(count({1<[filename] = p([filename])>} [filename]) > 50, Dual('50+ Times', 3)))))

, [filename])

ltc
Partner - Creator
Partner - Creator
Author

Yes, the last one worked.

I made a mistake with the suggestion you gave me yesterday.  I forgot that I changed the field "filename" to "Filename" with an uppercase F.  So that was the problem yesterday.  It's possible that the solution you gave me yesterday worked but it was my oversight with the field name change.  I'm going to use the last one though since I just tried it and it works. 

Thank you SO much!!