Page 1 of 1

Using Avg in a chart

Posted: Fri Nov 25, 2016 11:59 am
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

Re: Using Avg in a chart

Posted: Fri Nov 25, 2016 12:16 pm
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.

Re: Using Avg in a chart

Posted: Fri Nov 25, 2016 12:16 pm
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.

Re: Using Avg in a chart

Posted: Fri Nov 25, 2016 12:22 pm
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

Re: Using Avg in a chart

Posted: Mon Nov 28, 2016 7:34 am
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.

Re: Using Avg in a chart

Posted: Mon Dec 05, 2016 2:12 am
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 609 times

thanks

Matt

Re: Using Avg in a chart

Posted: Mon Dec 05, 2016 2:13 am
by mriggall
... plus also some sample test data...
TestDataSource.csv
(225 Bytes) Downloaded 526 times

Re: Using Avg in a chart

Posted: Mon Dec 05, 2016 3:13 pm
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.