Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis and using and/or

I want to

select

count(id)

where

field 1 like 'Inventory'

or field 2 = 'Inventory'

I need this in a chart expression.  I know that I can

field 1 = {*Inventory*},

field 2 = {'Inventory')}

likewise,

field 1 = {*Inventory*},

field 2 +={'Inventory') or -= or /=

I need to make sure that I count field one is inventory or  where filed 2 is inventory.

I am quite new to QlikView and any help would be appreciated.


1 Solution

Accepted Solutions
tresesco
MVP
MVP

Yes, you missed '<'. try:

count({<wr.Short_Description = {'*Inventory*'}> + <wr.Work_Request_Type = {'Inventory'} >} Work_Request_ID)

View solution in original post

15 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Try with this

Count({<Field1={*Inventory*}> + <Field2={'Inventory'}>} FieldName)

srchilukoori
Specialist
Specialist

I don't know if I understood your question properly but try this expression.

=Count({<Field1 = {'Inventory'}>} ID) + Count({<Field2 = {'Inventory'}>} ID) - Count({<Field1 = {'Inventory'}, Field2 = {'Inventory'}>} ID)

This expression gives you the count of ID, where only one of Filed1 and Field2 is equal to  "Inventory"

Carlos_Reyes
Partner - Specialist
Partner - Specialist

I haven't tested this but I would try:

Count( { $ < id = { " [Field 1] = 'Inventory' OR [Field 2]='Inventory' " } > } id)

Hope it works.

srchilukoori
Specialist
Specialist

Minor correction the above expression is a definition of (A union B) = either A or B or (A & B).

If you are looking for only (A or B), use the modified expression:

=Count({<Field1 = {'Inventory'}>} ID) + Count({<Field2 = {'Inventory'}>} ID) - 2*Count({<Field1 = {'Inventory'}, Field2 = {'Inventory'}>} ID)


jagan
Luminary Alumni
Luminary Alumni

Hi Robert,

Try this

=Count({<Field1={'*Inventory*'}> + <Field2={'Inventory'}>} FieldName)


Regards,

Jagan.

Not applicable
Author

This looks promising.  However, it gives me a syntax error.

I tried this

count({<wr.Short_Description = {'*Inventory*'}> + wr.Work_Request_Type = {'Inventory'} >} Work_Request_ID)

//Count({<Field1={*Inventory*}> + <Field2={'Inventory'}>} FieldName)

I maybe missing something in my syntax.

Not applicable
Author

No syntax error.  However, not giving me the field 1 or field 2.   I am getting 0 when I should have at least 68  where the field 1 like *Inventory*

Not applicable
Author

I am looking counts where have A or B.  I will test this to see the result.

CELAMBARASAN
Partner - Champion
Partner - Champion

You have missed on angular bracket before wr.Work_Request_Type

count({<wr.Short_Description = {'*Inventory*'}> + <wr.Work_Request_Type = {'Inventory'} >} Work_Request_ID)