Hi Don,
I assume you need a query calculation to achieve that. Here's an example on IBMs demo data:
I used the GO Sales (Query) package and wanted to count numbers of order lines where order method is 'Telephone".

The underlying calculation looks like this and I set it to count - you can use "total" as well:

I then added a footer to the page and created a "Singleton" there. Keep in Mind that you have to enable some data items in the "properties" setting. Otherwise, Cognos will only put those columns into the query that are used in the layout. This could lead to incomplete data as the query service doesn't know your grain of data. In my case it would only generate an SQL with the order method table in the FROM section and the counter then will return "1". Therefore I have to force the system to create a join to the sales order table by enabling the corresponding column:


------------------------------
Robert Dostal
Team Leader BI
GEMÜ
Ingelfingen
------------------------------
Original Message:
Sent: Thu July 27, 2023 05:26 PM
From: Don Per
Subject: Declaring vaqiable in cognos abalytics
I am trying to convert a crystal report to Cognos analytics report..
In my crystal reports formula, I declare a string variable and store some field information based on certain condition. Then in my group footer, I display the values using another formula.
ex:
StringVar vendors;
NumberVar vendCount;
If {table.Item} ="I001" then
(
vendCount := vendCount +1;
vendors := vendors + ", " + {table.VendorName}
)
I want to do similar this with Cognos and would like to know whether it is possible to create a variable, assign values and display them in group footer.
Any help is greatly appreciated.
------------------------------
Don Perera
------------------------------