Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8940

Re: Crosstab - column subreports

$
0
0

Hi Jakub,

 

Here's what you need to do:

 

1) While in the Preview Mode, right-click the header cell of the first column in the crosstab (In the example above, it is the January 2011 column) > Select Calculated Member > Insert Column.

A blank column with zero values is inserted.

 

2) Right-click the header cell of this Blank Column and select Calculated Member > Edit Header formula and type in this text:

 

"Subtotal"

 

3) Right-click the header cell again and select Calculated Member > Edit Insertion Formula. Type in this code:

 

GetColumnGroupIndexOf(CurrentColumnIndex) = 1
AND
(    if CurrentColumnIndex  <> GetNumColumns - 2 then        Year(GridRowColumnValue("Date")) <>        Year(GridRowColumnValue("Date", CurrentColumnIndex + 1))    else        Year(GridRowColumnValue("Date")) = Year(Maximum({Date}))        AND        Month(GridRowColumnValue("Date")) = Month(Maximum({Date}))
)

Note: In the above code, replace "Date" with the Date field used as Column in the Crosstab. The double-quotes are necessary and make sure to remove any parenthesis that CR automatically adds when a field is used in a formula.

 

Similarly, in the part where it reads Year(Maximum({Date})), replace {Date} with the Date field in the Crosstab however, this time use the parenthesis as in the code.

 

This should insert the Subtotal Column before a new year starts.

 

4) Next, right-click one of the zero values in the Subtotal column > Calculated Member > Edit Calculation Formula and use this code:

 

local currencyvar x;
local numbervar i;
local numbervar cindex := CurrentColumnIndex;
for i := 0 to cindex-1 do
(    if year(GridRowColumnValue("Date",i)) =        year(GridRowColumnValue("Date",cindex-1))  then    x := x + GridValueAt(CurrentRowIndex, i, CurrentSummaryIndex);
);
x;

Let me know how this goes.

 

-Abhilash


Viewing all articles
Browse latest Browse all 8940

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>