Calculate SUM of only displayed or visible values/cells in standalone telerik report designer

1 Answer 254 Views
Filtering General Discussions Grouping Report Designer (standalone) Table
Jayraj
Top achievements
Rank 1
Jayraj asked on 26 Dec 2022, 01:15 PM

Hello,

I have one table and I am getting values to display from sql data source.

I am displaying only some of values using filter and grouping of data, but I am getting wrong sum as it is taking from data source.

what should I do to get sum of only displayed values.

 

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Momchil
Telerik team
answered on 29 Dec 2022, 10:43 AM

Hi Jayraj,

In general, the filtering applied to a DataItem (a Table in this case) is applied to its entire data set, and any expression inside the aforementioned DataItem can have access only to subsets of the filtered data. If your Sum function does not respect that, I suspect that it is defined outside the scope of the Table. Could you verify if this is the case?

Speaking of "scope", it is important to mention that the result of an expression is highly dependent on the scope it is defined in. For example, if the Sum function is used in the scope of a particular Table group (more details about groups), it will sum only the values in said group, instead of summing the values inside the entire Table.

I am including a short demo report that illustrates these points.

If the issue persists, you could send a report sample to me so that I can investigate it locally.

Best Regards,
Momchil
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Jayraj
Top achievements
Rank 1
commented on 30 Dec 2022, 11:02 AM

Yes, I have implemented Grand total outside the table group, what should I do?
Momchil
Telerik team
commented on 30 Dec 2022, 03:37 PM

If moving the Total inside the Table, as shown in the demo report I provided, is not an option, you can do the following.

1. Add a List item to the report, apply the same DataSource that you used for the Table to it, and add the same Filters as well.

2. Add a fictitious parent group to the Details group of the List and make sure you check the Add Header option (the grouping expression is irrelevant since we are creating the group for the sole purpose of using its header).

We need this header in order to access the whole data set of the List, otherwise, the Details section of the List exposes only one record at a time.

3. Put your Table and the item containing the Total inside the header of the group created in the previous step.

(Optional). To make the report more efficient you can set the DataSource of the Table to the DataObject of the List containing it through Bindings.

Now the Total should be displayed properly.

I am attaching a modified version of my demo report that illustrates the above.

Tags
Filtering General Discussions Grouping Report Designer (standalone) Table
Asked by
Jayraj
Top achievements
Rank 1
Answers by
Momchil
Telerik team
Share this question
or