Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count function in QlikView

Hi, QlikView community

I using the count function to count containers in logistic company.

Here below is my datasets with four fields.

I am trying to count number of containers.

In this datasets I want the answear to be 3 containers. I want to know how many containers where used in every order for the whole time.

I know I can use Count (Distinct OrderID) to get the same result but I want to count the containers in the Containers field.

I was trying to use formula Count (Distinct Containers) but that is not possible because we use the same container for differenct Order ID in the dataset.

Do you guys know of any easy solution to count the containers so I can get 1 container for every month and when I sum the dataset I get 3 like in the formula Count (Distinct OrderID)

Regards Darri

   

PayerContainers                 OrderID  YrPer      
COCA-COLATGHU09683341002017-01
COCA-COLATGHU09683341002017-02
COCA-COLATGHU09683341002017-03
COCA-COLATGHU09683341002017-04
COCA-COLATGHU09683341002017-05
COCA-COLATRHU30705512002017-01
COCA-COLATRHU30705512002017-02
COCA-COLATGHU09683343002017-08
COCA-COLATGHU09683343002017-09
1 Solution

Accepted Solutions
sunny_talwar

Try this

=Count(DISTINCT Containers&OrderID)

View solution in original post

3 Replies
sunny_talwar

but I want to count the containers in the Containers field.

Count of containers in the container field? Can you elaborate on this?

Anonymous
Not applicable
Author

Hi,

what I mean is I want to count the numbers of container in the dataset and use the count function.

If I use Count (Containers) I will get total of 9 containers because there are 9 lines.

If I use Count (Distinct Containers) the answer will be 2 because there are two different containers in the dataset.

But I am looking to find numbers of containers that are used for every order ID.

I could use the formula Count( DISTINCT  OrderID) then I would get the answear I am looking for.

But I am looking for formula that counts the containers with the same result as counting the orderID

sunny_talwar

Try this

=Count(DISTINCT Containers&OrderID)