COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: kishor2010 on 12 May 2014 06:29:29 AM

Title: Pick up the initial value for every row of a crosstab
Post by: kishor2010 on 12 May 2014 06:29:29 AM
Hi all,
I have a requirement in which i have to pick up the initial value of each row in a crosstab..
My crosstab looks like this

value  1960   1970  2010  2011
aus       10         5       11      6
eng                             5        2
bra       11          4
ind                               8      11

i have to add another column which picks up the initial value for every row based on the year..
so the result should look like this.

value  1960   1970  2010  2011  initialValue
aus       10         5       11      6           10
eng                             5        2            5
bra       11          4                              11
ind                               8      11            8
Title: Re: Pick up the initial value for every row of a crosstab
Post by: adik on 12 May 2014 07:11:37 AM
i don't have a working cognos environment to test so this is of the top of my head:
createa a new data item as:
item(filter(members([year level]), tuple([Value], currentMember([time hierarchy]) is not null), 0)
Title: Re: Pick up the initial value for every row of a crosstab
Post by: Lynn on 12 May 2014 07:12:31 AM
You don't mention if your source is relational or dimensional.
Title: Re: Pick up the initial value for every row of a crosstab
Post by: adik on 12 May 2014 07:16:06 AM
yes, good question Lynn :)
i just assumed dimensional when i gave my answer
Title: Re: Pick up the initial value for every row of a crosstab
Post by: kishor2010 on 12 May 2014 08:20:05 AM
ya it is dimensional report...
Title: Re: Pick up the initial value for every row of a crosstab
Post by: MFGF on 12 May 2014 09:03:36 AM
Quote from: kishor2010 on 12 May 2014 08:20:05 AM
ya it is dimensional report...

In that case the solution adik proposed is almost correct - I tweaked it a little to get the result you are looking for:

tuple([Your measure],item(filter([Year level],tuple(currentMember([Time hierarchy]),[Your measure]) is not null),0))

Cheers!

MF.
Title: Re: Pick up the initial value for every row of a crosstab
Post by: kishor2010 on 13 May 2014 06:27:36 AM
Thanks for the reply..

But the problem is it is a relational database
Title: Re: Pick up the initial value for every row of a crosstab
Post by: MFGF on 13 May 2014 07:04:30 AM
Quote from: kishor2010 on 12 May 2014 08:20:05 AM
ya it is dimensional report...

Quote from: kishor2010 on 13 May 2014 06:27:36 AM
But the problem is it is a relational database

Hmmm. We have two conflicting answers from you here. Which is it? Is your package relational (ie query subjects and query items) or dimensional (ie dimensions, hierarchies, levels, members, measures etc)?

The answer is important because it has a big impact on the approach any solution needs to take.

MF.
Title: Re: Pick up the initial value for every row of a crosstab
Post by: kishor2010 on 13 May 2014 07:08:19 AM
I am really sorry for the conflict..

My package is relational (ie query subjects and query items)
Thanks in advance
Title: Re: Pick up the initial value for every row of a crosstab
Post by: kishor2010 on 13 May 2014 11:17:25 PM
I am waiting for the solution.. please reply
Title: Re: Pick up the initial value for every row of a crosstab
Post by: ToriBurns on 14 May 2014 02:39:44 AM
Try to add a query calculation for initial value and typed this code on the expression:

case when [Year] = minimum([Year])
then
total([Presentation View].[Financial Consolidated].[CY Actual] for [Group Level1],[Year])
end

Replace the columns:
[Year] with your year column, [Level1].[Level2].[Amount] with your column that contains aus, eng, bra, ind. And, [Val] with your column that contains the value or the amount (your measure). I used a crosstab to try this. If you have any question feel free to ask. Hope it helps. :)

By the way, [Level1].[Level2].[Amount] is your measure. I guess it's [Value] on your case. It is the measure that you dragged on the crosstab intersection if you are using a crosstab.
Title: Re: Pick up the initial value for every row of a crosstab
Post by: MFGF on 20 May 2014 10:02:15 AM
Quote from: kishor2010 on 13 May 2014 11:17:25 PM
I am waiting for the solution.. please reply

We are waiting for your response to the helpful message that was posted... If it worked, you should thank Tori. Please reply...
Title: Re: Pick up the initial value for every row of a crosstab
Post by: kishor2010 on 23 Jan 2015 04:55:31 AM
Sorry Tori and MFGF, i had parked that issue aside, now i will check and update..
Thanks for the reply..  :)