This is a migrated thread and some comments may be shown as answers.

Compute difference between columns on crosstab

1 Answer 229 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 22 Oct 2015, 10:34 PM

I'm trying to compute the difference between two columns in a crosstab.

 The columns are generated based on a year value in the data source (spanning the last 5 years) and the field values are counts of the number of items in the data set that fall in the given year. I'm trying to add a column at the end which shows the increase/decrease in the counts between two of those columns (the first year in the 5-year period and the last year in the 5-year period). Since I don't know what the values of those years are, I need to determine those at runtime. (See ASCII example below)

Is there an easy way to do this? I've created a report parameter based on a stored procedure which gets me the value of the last year and then I calculate 5 years back from there but it doesn't seem like a very elegant solution.

Thanks,

Chris N

 

2011  2012  2013  2014  2015  5Y Increase

------------------------------------------------------------

3        4         3        6         10     7

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 26 Oct 2015, 12:39 PM
Hi Chris,

The Table item is a data-driven item, which visualizes data. Thus to have a column reflecting changes per row, you can:
  1. Add a calculated field based on the other fields in the record;
  2. Add a field in the data object, which gets the desired calculated value;
  3. If you need more complex calculations, use a custom function or aggregate.


If you need further help, please elaborate on the scenario with data examples and the formula which has to be used for the last column.

Regards,
Stef
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
James
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or