Is there a builtin function of any type in the crosstabs to generate % instead of count or sum? (val / grandtotal or rowcount)? ie =(Fields.myColumn/rowcount)
I want my report to look like this
txt3 txt4 txt5
txt1 3% 10% 35% 6,256
txt2 10% 15% 27% 8,456
2,123 5,999 6,590 14,712
What is the best way to handle this?
I want my report to look like this
txt3 txt4 txt5
txt1 3% 10% 35% 6,256
txt2 10% 15% 27% 8,456
2,123 5,999 6,590 14,712
What is the best way to handle this?
4 Answers, 1 is accepted
0
Hello Joel,
Peter
the Telerik team
To get a percent of the grand total you will have to use the Function Exec in a CrossTab's Textbox Expression value.
The Exec(scope, expression) function executes the specified expression in the given data scope. It is used mostly with aggregate expressions as a second parameter. This function allows changing of the data scope in which the expression is evaluated. Scope parameter is the name of the data scope we need to evaluate the expression against.
For example your expression have to look like the following one:
= Sum(Fields.myColumn)/Exec("crosstab1",Sum(Fields.myColumn))
Peter
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Travis
Top achievements
Rank 1
answered on 27 Apr 2011, 06:12 PM
Very cool! I have a couple more situations involving percentages. I have a cross tab report which has a Year column specified. There can be multiple years, thus multiple columns. I want to get the percentage change from one year to the next:
Year1 Year2 Year3
-- %5 %2
-- %3 %10
Another scenario is I need to get cumulative percentage change from year 1 ( hopefully this one makes sense)
Year1 Year2 Year3
-- %5 %7
-- %3 %13
Are these 2 scenarios supported somehow using the Exec(scope,expression) or perhaps another function?
Year1 Year2 Year3
-- %5 %2
-- %3 %10
Another scenario is I need to get cumulative percentage change from year 1 ( hopefully this one makes sense)
Year1 Year2 Year3
-- %5 %7
-- %3 %13
Are these 2 scenarios supported somehow using the Exec(scope,expression) or perhaps another function?
0
Hi Travis,
Up to your first requirement - we don't have a previous function,however this is in our TODO list. In the meantime as a workaround you can use the report events. I am not sure about your concrete requirement and data but the following sample code snippet should give you an idea:
Peter
the Telerik team
Up to your first requirement - we don't have a previous function,however this is in our TODO list. In the meantime as a workaround you can use the report events. I am not sure about your concrete requirement and data but the following sample code snippet should give you an idea:
private decimal previous;
private object year;
private void textBoxFact_ItemDataBound(object sender, EventArgs e)
{
var textbox = (sender as Telerik.Reporting.Processing.TextBox);
if (textbox.DataObject["OrderDate"].Equals(year))
{
previous -= decimal.Parse(textbox.Value.ToString());
}
else
{
year = textbox.DataObject["OrderDate"];
previous = decimal.Parse(textbox.Value.ToString());
}
textbox.Value = previous;
}
private void ProductSales_ItemDataBinding(object sender, EventArgs e)
{
previous = 0;
year = string.Empty;
}
To accumulate values in specified scope our suggestion is to utilize the RunningValue function
All the best,Peter
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Alberto
Top achievements
Rank 1
answered on 28 Nov 2013, 07:08 PM
= CDbl(Sum(Fields.NumeroODD)) / CDbl(Exec("crosstab1" , Sum(Fields.NumeroODD)))
have to use CDbl()