Crosstab Summary that is a % of Total

Stimulsoft Reports.WEB discussion
srichardson
Posts: 14
Joined: Thu Jul 26, 2012 9:52 pm

Crosstab Summary that is a % of Total

Post by srichardson »

I have a crosstab with the following info
Row: State
Column: Month
Summary: Units
Amount
% Total

I have everything working except the % Total summary. I need to be able to show the following where the % Total is equal to the Amount for the State divided by the Total Amount for all states. How do I accomplish this? I tried using this expression:
{Details.LoanAmount / (double)Totals.Sum(Data, Details.LoanAmount)} but it's not coming out as expected.

Thanks!
Attachments
crosstab.png
crosstab.png (6.76 KiB) Viewed 3980 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Crosstab Summary that is a % of Total

Post by HighAley »

Hello.

Please, read the Calculating percents in columns of cross-tab article on our Knowledge Base.

Thank you.
srichardson
Posts: 14
Joined: Thu Jul 26, 2012 9:52 pm

Re: Crosstab Summary that is a % of Total

Post by srichardson »

Do you happen to have a sample report with this functionality that I can review, I'm unsure how it all fits together.
Thanks
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Crosstab Summary that is a % of Total

Post by HighAley »

Hello.

Here is a sample report.
StandardCrossTabPercentByColumn.mrt
(29.93 KiB) Downloaded 536 times
Thank you.
srichardson
Posts: 14
Joined: Thu Jul 26, 2012 9:52 pm

Re: Crosstab Summary that is a % of Total

Post by srichardson »

When I copy the code entered in the ProcessCell from your sample report, I receive an error "The name'ht' does not exist in the current context". Playing with the code, I can get the % to come up using the row total...but I cannot get the denominator to use the column total for my field.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Crosstab Summary that is a % of Total

Post by Alex K. »

Hello,

Please check that you copy additional code from Code tab:

private System.Collections.Hashtable ht = new System.Collections.Hashtable();

Thank you.
srichardson
Posts: 14
Joined: Thu Jul 26, 2012 9:52 pm

Re: Crosstab Summary that is a % of Total

Post by srichardson »

I'm having trouble locating the Code Tab. Would it be possible to show me how to access using your demo site http://web.stimulsoft.com/Design/Reports/LargeCrossTab ?
Thanks!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Crosstab Summary that is a % of Total

Post by Alex K. »

Hello,

Please clarify which version do you use. In the WebDesigner is not available the Code Tab.

Thank you.
srichardson
Posts: 14
Joined: Thu Jul 26, 2012 9:52 pm

Re: Crosstab Summary that is a % of Total

Post by srichardson »

I use Reports.Web version 2013.1.1600

I tried adding System.Collections.Hashtable ht = new System.Collections.Hashtable() to some of the Print/Render Events in order to get it added to the code, but it is still coming back stating "The name 'ht' does not exist in the current context"
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Crosstab Summary that is a % of Total

Post by HighAley »

Hello.

Please, use next option to enable Code tab in the Web Designer.

Code: Select all

StiWebDesignerOptions.CodeTabVisible = true;
Thank you.
Post Reply