Using Avg in a chart

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

Using Avg in a chart

Post by mriggall »

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 »

... 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 »

... 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 »

... 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: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Using Avg in a chart

Post by Alex K. »

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 »

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 525 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 »

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

Re: Using Avg in a chart

Post by HighAley »

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 466 times
Locked