Using Avg in a chart

Stimulsoft Reports.Silverlight discussion
Post Reply
mriggall
Posts: 57
Joined: Mon May 07, 2012 7:41 pm
Location: Melbourne

Using Avg in a chart

Post by mriggall » Fri Nov 25, 2016 11:59 am

Hi Aleksey & Team

I have a client who wants to display the average of a data series in a chart, but when we add the expression as Avg(BusinessObject.Column) then we get an error that "The name 'Avg' does not exist in the current context."

We are using the Silverlight 2016.1 version of the reporting control - how do we display an average of a data series as a chart?

thanks!

Matt
mriggall
Posts: 57
Joined: Mon May 07, 2012 7:41 pm
Location: Melbourne

Re: Using Avg in a chart

Post by mriggall » Fri Nov 25, 2016 12:16 pm

... sorry - I realised that I already asked this question before! :) I will try and create a new datasource from existing datasource. Your previous answer Aleksey mentioned to structure the Average in the SQL query, but that's not possible since we use business objects and not direct data source connection.
mriggall
Posts: 57
Joined: Mon May 07, 2012 7:41 pm
Location: Melbourne

Re: Using Avg in a chart

Post by mriggall » Fri Nov 25, 2016 12:16 pm

... sorry - I realised that I already asked this question before! :) I will try and create a new datasource from existing datasource. Your previous answer Aleksey mentioned to structure the Average in the SQL query, but that's not possible since we use business objects and not direct data source connection.
mriggall
Posts: 57
Joined: Mon May 07, 2012 7:41 pm
Location: Melbourne

Re: Using Avg in a chart

Post by mriggall » Fri Nov 25, 2016 12:22 pm

... I tried to create a new business object based on the existing business object, but it isn't quite clear that this will work - I tried to add a calculated column and got the same error "The name 'Avg' doesn't exist in the current context."

Is there any other way to show an Average of values in a chart?

thanks

Matt
Alex K.
Posts: 6489
Joined: Thu Jul 29, 2010 2:37 am

Re: Using Avg in a chart

Post by Alex K. » Mon Nov 28, 2016 7:34 am

Hello Matt,

Please try to use the Totals function.
If the issue still present, please send us a sample report with test data for analysis.

Thank you.
mriggall
Posts: 57
Joined: Mon May 07, 2012 7:41 pm
Location: Melbourne

Re: Using Avg in a chart

Post by mriggall » Mon Dec 05, 2016 2:12 am

Hi Aleksey

I have attached a sample .mrt file to demonstrate the problem. Even using Totals.Avg() no value is calculated...
Report.mrt
(14.76 KiB) Downloaded 149 times

thanks

Matt
mriggall
Posts: 57
Joined: Mon May 07, 2012 7:41 pm
Location: Melbourne

Re: Using Avg in a chart

Post by mriggall » Mon Dec 05, 2016 2:13 am

... plus also some sample test data...
TestDataSource.csv
(225 Bytes) Downloaded 95 times
HighAley
Posts: 8065
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Using Avg in a chart

Post by HighAley » Mon Dec 05, 2016 3:13 pm

Hello.

Please, try to add the Read Only variable and use it in the Before Print event of the chart.
The average line could be shown with the Constant Line.
Please, look at the attached report template.

Thank you.
Attachments
ChartAvg.mrt
(13.67 KiB) Downloaded 120 times
Post Reply