COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ccbarbeau on 01 Feb 2016 02:42:46 PM

Title: Passing multiple prompt values into calculated data item
Post by: ccbarbeau on 01 Feb 2016 02:42:46 PM
Good afternoon,

I have a requirement where my user needs to choose a few months and have me add up the numbers that are in the associated columns for a column in the output. I am working with relational data. my table looks like this:

                     Jan   Feb  Mar  Apr
Part                5       5     6      8

So the user chooses Months (ie Jan and Feb) and the calculated item would be 10.

I have tried #prompt, #promptmany... I cannot seem to get this working.

Any ideas?

Thanks!
Title: Re: Passing multiple prompt values into calculated data item
Post by: BigChris on 02 Feb 2016 02:20:59 AM
Assuming that's your table, rather than a crosstab built over your table, you're probably going to want something like:

January: if(?pMonth? contains 'Jan') then ([Jan]) else (0)
February: if(?pMonth? contains 'Feb') then ([Feb]) else (0)
etc.

You could also have some render variables that only show the columns that you select in your prompt. At the end of your report you'd then have a field for

Total: [January] + [February] + [March] etc.
Title: Re: Passing multiple prompt values into calculated data item
Post by: ccbarbeau on 08 Feb 2016 09:24:13 AM
Thank you, that worked perfectly!