Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count or If statement

I am trying to Count all the Shirts that are blue with orders less that 240. However I am putting this data in a filter and keep getting invalid dimension.

Below is the expressions that I wrote. I get an OK from the expression check in Qlik Sense but no display. Not sure what I am doing wrong but any help would be appreciated.

=Count({$<Shirts = {'Blue'} >} [Shirt Orders]<240)

another Expression

=If(Shirts = 'Blue',Count([Shirt Orders]) <240)

Kurleigh

9 Replies
sunny_talwar

May be this

If(Count({$<Shirts = {'Blue'}>} [Shirt Orders]) < 240, Count({$<Shirts = {'Blue'}>} [Shirt Orders]))

sunny_talwar

Or this

Count({<Shirts = {'Blue'}*{"=Count({$<Shirts = {'Blue'}>} [Shirt Orders]) < 240"}>} [Shirt Orders])

Not applicable
Author

Thanks,

I tried the first expression and it returned a blank result. Not sue why I can def see their are blue shirts with orders less that 240.

The second expression gave me and error.

neha_shirsath
Specialist
Specialist

try with this-

if(Shirts='Blue' and [SHirt Orders]<240,Count([SHirt Orders]))

pathiqvd
Creator III
Creator III

Hi,

Try This,

=count({<Shirts={"Blue"},[SHirt Orders]={"<240"}>}[SHirt Orders])

Regards,

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

Try both conditions in set.

Count({<Shirts ={"Blue"},[Shirt Orders]={"<240"}>} [Shirt Orders])

tresesco
MVP
MVP

I guess if Shirts actually holds color code, there has to be a separate field for shirt itself, may be like ShirtCode. And then, you perhaps could try like:

Count( DISTINCT {<ShirtCode={"=Count({<Shirts={'Blue'}>} [Shirt Orders])<240"}>}ShirtCode)

Note: Adjust the fields in your context.


Edit: DISTINCT

passionate
Specialist
Specialist

Hi Henry,

Provide some data dumps.

The above solutions must work.

Regards,

Pankaj

Not applicable
Author

Thanks Lakshmipathi,

Your solution with what I was looking for. Also,Thanks everyone for chiming it with help.