7 Replies Latest reply: Jul 1, 2015 6:15 AM by Jean-Philippe Favre

# what is the count() function ? and how can i use this ?

what is the count() function ? and how can i use this ?   explain me pls........................

• ###### Re: what is the count() function ? and how can i use this ?

I suggest looking at the Help file or reference manual or searching the forum.

• ###### Re: what is the count() function ? and how can i use this ?

Simply is an aggregation function that counts the numbers of items under a certain condition

E.g.: Count(Customers)

Count(distinct Customers)

You can use Count() in script or in expression and in the last you can add set analysis

• ###### Re: what is the count() function ? and how can i use this ?

Hi Sandeep,

Count()

This function returns the count of an expression over a number of records in business data as defined by a group by clause. If the distinct occurs before the expression, all duplicates will be discarded.

Syntax

count([distinct ] expression | * )

Example

Load Month, count(Sales) as NumberOfSalesPerMonth from abc.xls group by Month;

LoadMonth, count(*) as NumberOfRecordsPerMonth from abc.xls group per Month;

Type of Count function:

NumericCount()

TextCount()

NullCount()

MissingCount()

Count or Count distinct?

Thanks

• ###### Re: what is the count() function ? and how can i use this ?

Hi

Count():

Returns the aggregated total count of values from expression or field iterated over the chart dimension(s).

For this function it is allowed to use the distinct qualifier in combination with the total qualifier This combination is not valid for any other aggregation functions.

Examples:

coung(Sales)

count(Price*Quantity)

count(distingct Price)

count(Sales)/count(total Sales) returns sales within the selection

Thanks

• ###### Re: what is the count() function ? and how can i use this ?

Hello Sandeep,

It s part of the Aggregation function. the basic use would be to count how many times something happen in a list.

For example, i am dealing here with hotel packages (forfait) and with the following expression, i would ask Qlikview

Everytime, you have 'Forfait' a in the column Type_Forfait, you count the value in the column Unit

=count({<Type_Forfait={'Forfait'}>} Units)

The official definition is : Returns the count of expression over a number of records as defined by a group by clause. If the word distinct occurs before the expression, all duplicates will be disregarded.

Pay attention also to the function called DISTINCT very important for that kind of activity.\$

If you need more help, please provide me with some détails.

Attached, the visual use of my expression. The column "NOMBRE" returns the number of package.

Best

JP

• ###### Re: what is the count() function ? and how can i use this ?

thanks for everyone

• ###### Re: what is the count() function ? and how can i use this ?

You are welcome, you can then close the case have a nice day.