Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
avishaiz
Contributor III
Contributor III

count if

i want to count the number of lines where there is a difference between inventory and counted

sample data:

item namedateinventoryconted
aaa22/8/2015154
bbb13/7/20157065

one time just to count the number of lines where there is a difference between inventory and counted

another value is the number of lines where inventory was larger

another value is the number of lines where inventoty was smaller

6 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Use this expresison and let me know:

Sum(if(inventory<>counted,1,0)

Sum(if(inventory>counted,1,0)


Sum(if(inventory<counted,1,0)

Anonymous
Not applicable

try like this?

1)=count(If(Inventory<>Conted, ItemName))


2)

=count(If(Inventory>Conted, ItemName))


3)

=count(If(Inventory<Conted, ItemName))

its_anandrjs

Hi,

Need to know Inventory and ItemName are dimension or just field if they are field you can try this ways also with calculated dimension.

1. If(inventory = counted, 'Same','Not Same')

2. If(inventory > counted, 'Greater','Smaller')

Regards,

Anand

avishaiz
Contributor III
Contributor III
Author

Hi Anand

hey are just field names

Not applicable

Hi,

I suggest you to create a new column during data loading that will contain "A" if the values are equal, a "B" if inventory  > Counted and "C" if Inventory < Counted

LOAD

...

if (Inventory = Counted ,'A',if(Inventory > Counted,'B',if(Inventory < Counted, 'C'))) as [Type]

...

Then you can add 3 KPI counting each letter

Count(if(Type = 'A', Type))

Count(if(Type = 'B', Type))

Count(if(Type = 'C', Type))

Philippe

avishaiz
Contributor III
Contributor III
Author

i preffer to do all the data manipulation in qlik that way when i work with my database i can have it all done without having to modify the data.

unless when i do a column it will automatically do the calculation when it loads the data from the database