COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: bloopaman on 30 Aug 2013 11:50:18 AM

Title: Master-Detail Help Needed
Post by: bloopaman on 30 Aug 2013 11:50:18 AM
All,

Relational data source.  I have a requirement to produce a report which produces a page per distinct value in a column.  On each page I need to show the sum of some columns for the distinct value selected, and the remaining, in cross tab columns.  I need to be able to do this with master detail relationships I believe, but I can only "FILTER" to display items pertaining to the master item  selected for the page.  I have no idea how to get the remaining.  For example, I have the following data:

GROUP, VALUE
A, 10
B, 10
C, 10

I need a cross tab that appears like:
            A       Remaining
Value   10      20

...and on the next page
            B       Remaining
Value   10      20


ETC.  Please help!
Title: Re: Master-Detail Help Needed
Post by: RKMI on 30 Aug 2013 01:22:13 PM
Hi,

I think this can be done in list using section.

First add a new data item ( Total Group) and the calc as  total([value]) - total( [value] for [group]), that should give you the following.

GROUP, VALUE, Total Group
A         , 10      ,50
B         , 20      ,40
C         , 30      ,30

After which you can section the list for the group and then set pagebreak on group so that it appears on its own page.

Hope this helps.

Thanks,
RK
Title: Re: Master-Detail Help Needed
Post by: bloopaman on 30 Aug 2013 01:38:38 PM
Except I don't want to show the totals... I want to show the remaining.

And just to clarify, I need to display the measures along the rows.  So
                     A   Remaining
VALUE1        10              20
VALUE2        10              20

--------- PAGE BREAK

                     B   Remaining
VALUE1        10              20
VALUE2        10              20

Title: Re: Master-Detail Help Needed
Post by: Lynn on 30 Aug 2013 02:00:02 PM
Quote from: bloopaman on 30 Aug 2013 01:38:38 PM
Except I don't want to show the totals... I want to show the remaining.

And just to clarify, I need to display the measures along the rows.  So
                     A   Remaining
VALUE1        10              20
VALUE2        10              20

--------- PAGE BREAK

                     B   Remaining
VALUE1        10              20
VALUE2        10              20



Look again at the expression RK gave you and the data example provided.

total([value]) - total( [value] for [group])

That looks to me like it will give you the remaining amount you want.
Title: Re: Master-Detail Help Needed
Post by: bloopaman on 30 Aug 2013 02:34:17 PM
No, the calculation is not working.  This is a relational datasouce and the query....

total(Value) - total(Value for Group) is simply evaluating total(Value) and total(Value for Group) to the same number and producing 0.  Replacing the expression left of the minus sign with Total(Value for all Group) has no effect. 

How do I get the measures along the left side going down with a list through?
Title: Re: Master-Detail Help Needed
Post by: RKMI on 30 Aug 2013 05:31:02 PM
Hi,

What mentions is correct. It suppose to be remaining value sorry named it wrong.

I'm also using a relational model, here is a my expression below,

Total( [value] for report) - total( [value] for [Group])

I forgot to add the for report in the first total.

Thanks,
RK