Business Objects: Count v CountAll
I’m going to quickly run through the difference between the Count and CountAll function. Note that the CountAll function is only available in Full Client. Web Intelligence provides the Count function with a set of parameters, which I will discuss later.
Let’s take a simple example data set:
Two columns, one called Name and the other called Function.
Lets create eight rows of tab delimited data in a text file as follows:
Note that the seventh row does not have a persons name. Let us assume this is a position that needs to be filled. The eighth row has a name and no function.
If we load this data into BusinessObjects, we get the following result:
What result do you expect if you perform a count on the name column? Remember, you have loaded 8 rows.
If you guessed 6, you are correct.
To prove this, select the n icon from the toolbar or right click on the column and select Calculations/Count, an additional row is added to the table with the value 6. If you take a look at the formula behind the value 6, you will see it is =Count(<Name>).
Now if you perform a CountAll on the name column, what value do you expect to see?
If you guessed 7, you are wrong. Why? Because CountAll counts all rows, including duplicate values and empty rows.
To prove this, right click again on the column and select Calculations/CountAll. An additional row is added to the table with the value 8.
We can repeat this exercise on the Function column. Remember, we loaded 8 rows. What will be returned if you run a Count on the Function column?
If you guessed 7, you are wrong. Count will return a count of DISTINCT rows. So while you have loaded 8 rows, two of those contain Sales. Hence the Count will return one count of Sales. Also note it will not count empty rows.
To prove this, select the n icon from the toolbar or right click on the column and select Calculations/Count, an additional row is added to the table with the value 6. If you take a look at the formula behind the value 6, you will see it is =Count(<Function>).
So what value will be returned if we perform a CountAll?
If you guessed 8, you are correct. CountAll will return a sum of all rows, including duplciates an empty rows.
Web Intelligence: Count
If you are using Web Intelligence, you will not have a CountAll function. Instead you have a Count function two parameters:
Count([object]; [INCLUDEMEPTY]; [DISTINCT|ALL])
Using our example data set, what will Count([Name]) return?
The answer is 6. Count([Name]) will return a distinct list of Names.
What do you think will be returned by Count([Name];[INCLUDEEMPTY])?
If you guessed 8, you are wrong. If you guess none, well done.
Why? Okay, I slightly misled you. The syntax of the formula is incorrect. If you are including a parameter, do not use the square brackets for the parameter. The correct formula is: Count([Name];INCLUDEEMPTY).
This will bring back 7 rows. Six distinct rows plus an empty row.
So how many rows are counted using Count([Name];INCLUDEEMPTY;DISTINCT)?
The answer is 7. You bring back all the distinct rows (there are six – John is duplicated), and one empty row.
So what will Count([Name];INCLUDEEMPTY;ALL) bring back?
The answer is 8. All rows, including duplicates and empty rows.
There are valid scenarios where you may want to use the CountAll or Count([Name];ALL) function. It is important to be clear on where these functions should be used, as used incorrectly, they could bring back incorrect results.
Did you find this type of article useful? Are there any other functions that you would like me to walk through? If so, please let me know via a comment. Thanks for reading!





