COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: a1003520 on 29 Sep 2016 03:19:10 AM

Title: count example
Post by: a1003520 on 29 Sep 2016 03:19:10 AM
could you explain how the count([column1] for [column2]) really work with an example.
Also can sum([column1] for [column2]) also work? And with example if possible
Title: Re: count example
Post by: AnalyticsWithJay on 29 Sep 2016 08:54:56 AM
Location          Employee           
US                   John
US                   Nancy
Canada            Alex

count([Employee] for report)
Result: 3

count([Employee] for [Location])
Result:
US          2
Canada   1

It's basically a count, and you specify what you want to group the count by. If you wanted to further break it down by State/Province, you could do count([Employee] for [Location],[State]).

You could use the for statement with sum, max, min, etc. They work in the exact same way. For example, if you wanted a breakdown of revenue by retailer you could total([revenue] for [retailer]).