COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: priyanka on 24 Dec 2015 08:20:54 AM

Title: About Sum Function in expression definition
Post by: priyanka on 24 Dec 2015 08:20:54 AM
could you please tell What does the sum function do in expression definition?

sum(If ([Products].[Sales].[STATUS] IN ('Success'))
THEN (1)
ELSE (0) )
Title: Re: About Sum Function in expression definition
Post by: MFGF on 24 Dec 2015 08:31:41 AM
Quote from: priyanka on 24 Dec 2015 08:20:54 AM
could you please tell What does the sum function do in expression definition?

sum(If ([Products].[Sales].[STATUS] IN ('Success'))
THEN (1)
ELSE (0) )

Hi

If ([Products].[Sales].[STATUS] IN ('Success'))
THEN (1)
ELSE (0)


This returns a 1 or a 0 for each product sale. If you have 1000 sales you will have a mixture of 1000 1 and 0 values returned.

sum([the expression above])

will return the sum of these 1 and 0 values.

MF.

Title: Re: About Sum Function in expression definition
Post by: cvamarley on 28 Dec 2015 03:10:51 AM
Addition to that..

As far as I remember, we don't have the function named as 'SUM' in Report Studio. It should be 'TOTAL'.

Please correct me If i'm wrong.