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: 
its_anandrjs

Aggregation functions for Count and Sum

Hi All,

Any one provide details about the Aggr function for count and sum and more with details. Help will be appreciated

Regards,

Anand

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

What sort of details?  Here's the help text if you haven't read it.  I'm not sure what else I can provide.

sum( [{set_expression}] [ distinct ] [ total [<fld {, fld}>] ] expression )

Returns the aggregated sum of expression or field iterated over the chart dimension(s).

Examples:

sum( Sales )

sum( Price*Quantity )

sum( distinct Price )

sum( Sales ) / sum( total Sales )

returns sales within the selection.

sum( Sales ) / sum( total <Month> Sales )

returns sales within the selection for each Month

sum( Sales ) / sum( total <Month,Grp> Sales )

returns sales within the selection for each Month and Grp

sum( Sales ) / sum( {1} totalSales  )

returns sales within the entire document.

sum( {BM01} Sales )

returns sales within the selection defined by bookmark BM01.

sum({$<Year={2007,2008}>}Sales)

returns the sales for the current selection but just for year 2007 and 2008, i.e. the same as Sum(if(Year=2007 or Year=2008,Sales))

count( [{set_expression}] [ distinct ] [ total [<fld {, fld}>] ]expression)

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:

count( Sales )

count( Price*Quantity )

count( distinct Price )

Count( Alpha ) / Count ( Distinct Total Alpha)

count( Sales ) / count( total Sales )

returns sales within selection.

View solution in original post

2 Replies
johnw
Champion III
Champion III

What sort of details?  Here's the help text if you haven't read it.  I'm not sure what else I can provide.

sum( [{set_expression}] [ distinct ] [ total [<fld {, fld}>] ] expression )

Returns the aggregated sum of expression or field iterated over the chart dimension(s).

Examples:

sum( Sales )

sum( Price*Quantity )

sum( distinct Price )

sum( Sales ) / sum( total Sales )

returns sales within the selection.

sum( Sales ) / sum( total <Month> Sales )

returns sales within the selection for each Month

sum( Sales ) / sum( total <Month,Grp> Sales )

returns sales within the selection for each Month and Grp

sum( Sales ) / sum( {1} totalSales  )

returns sales within the entire document.

sum( {BM01} Sales )

returns sales within the selection defined by bookmark BM01.

sum({$<Year={2007,2008}>}Sales)

returns the sales for the current selection but just for year 2007 and 2008, i.e. the same as Sum(if(Year=2007 or Year=2008,Sales))

count( [{set_expression}] [ distinct ] [ total [<fld {, fld}>] ]expression)

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:

count( Sales )

count( Price*Quantity )

count( distinct Price )

Count( Alpha ) / Count ( Distinct Total Alpha)

count( Sales ) / count( total Sales )

returns sales within selection.

Not applicable

Thanks John, This is really Helpful

This solved my issue