COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: RubenvdLinden on 07 Oct 2009 04:13:12 AM

Title: Count members in a set
Post by: RubenvdLinden on 07 Oct 2009 04:13:12 AM
Hi,

I have a report where the user can select a year and the month of the year.
Next, I created a new data item [YTD] and used periodsToDate to get all months until the selected month.
I would like to count these months, so I tried to create a new dataitem [Number of months] with the expression

count(1 within set set([YTD]))

Until here, everything works fine.


Finally, I added a simple prognosis using

[Result] / [Number of months] * 12

The expression evaluates fine, however when I try to run the report it returns:

OP-ERR-0046 Unable to support query items from the same dimension on different report dimensions: {0}.
OP-ERR-0046 Unable to support query items from the same dimension on different report dimensions: <nodeRef ID="OPSummaryQuery::CheckQRDDimensions()"/><nodeRef ID="dimension="[MEASURES]"; edge="axis(2)"; edge="axis(0)""/>.


I hope anyone can help me or provide me with a better solution to calculate my prognosis.
Thank you.
Title: Re: Count members in a set
Post by: billylodz on 07 Oct 2009 04:40:25 AM
try this
total(currentMeasure within set [YTD]) /count(currentMeasure within set [YTD]) *12
Title: Re: Count members in a set
Post by: TomasF on 07 Oct 2009 05:43:29 AM
or this:

12 * average(currentMeasure within set [YTD])


    Tomas
Title: Re: Count members in a set
Post by: RubenvdLinden on 07 Oct 2009 08:10:49 AM
Thank you both.

I replaced currentMeasure with the actual measure I needed to make it work.
My solution to count the members was a bit difficult, considering the possibility to use the average function directly ...