<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://uat.community.rws.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Calculated Fields at the Summary Level</title><link>https://uat.community.rws.com/product-groups/trados-portfolio/business-manager/w/wiki/4871/calculated-fields-at-the-summary-level</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12 Non-Production</generator><item><title>Calculated Fields at the Summary Level</title><link>https://uat.community.rws.com/product-groups/trados-portfolio/business-manager/w/wiki/4871/calculated-fields-at-the-summary-level</link><pubDate>Tue, 16 Jul 2019 09:34:25 GMT</pubDate><guid isPermaLink="false">10acfa76-f078-475b-a7ef-fc5b3e8d2934:c5439d9c-fc85-40fb-91a5-88f700a755bc</guid><dc:creator>Eugene Kuchynski</dc:creator><comments>https://uat.community.rws.com/product-groups/trados-portfolio/business-manager/w/wiki/4871/calculated-fields-at-the-summary-level#comments</comments><description>Current Revision posted to Wiki by Eugene Kuchynski on 7/16/2019 9:34:25 AM&lt;br /&gt;
&lt;p&gt;When you create calculated fields in the QuickReports designer, their values are calculated on the base of individual data source rows. Then, when this calculated field is used in any dashboard widget, you apply selected summary function to it.&lt;/p&gt;
&lt;p&gt;About this task&lt;br /&gt;Let&amp;#39;s take Translation jobs table as data source and create new calculated field called Amount per hour. Using expression builder you can quickly build the following expression for this calculated field: [Amount (base cur)] / [Edit time (minutes)] * 60&lt;/p&gt;
&lt;p&gt;This calculated field allows to get earned amount per hour for each job. If to drag this column to a &lt;strong&gt;Table&lt;/strong&gt;, &lt;strong&gt;Chart&lt;/strong&gt;, &lt;strong&gt;Pivot table&lt;/strong&gt; or any other widget, you will be able to select summary function for this field.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-02-93/7801.image.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;On provided screenshot you can see that &lt;strong&gt;Amount (base currency)&lt;/strong&gt;, &lt;strong&gt;Edit time (minutes)&lt;/strong&gt; and &lt;strong&gt;Amount per hour&lt;/strong&gt; fields were put onto the &lt;strong&gt;Values&lt;/strong&gt; section of the pivot table, and &lt;strong&gt;Date&lt;/strong&gt; field was put into &lt;strong&gt;Rows&lt;/strong&gt; section. Average amount per hour is calculated by summing this value for each job in specified year and dividing it by a number of jobs. Because of that, applying provided expression to summary values shown on the screenshot would not give value in the last column.&lt;/p&gt;
&lt;p&gt;To calculate expression on a summary level, right click on a calculated field, select &lt;strong&gt;Edit expression&lt;/strong&gt;, expand &lt;strong&gt;Functions&lt;/strong&gt; node and select &lt;strong&gt;Aggregate&lt;/strong&gt; functions:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-02-93/0066.image-_2800_1_2900_.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;You can select from a number of aggregate functions to calculate your values on a summary level.&lt;/p&gt;
&lt;p&gt;For the first row, 6626.96 / 15028 * 60 gives 26.46. &lt;strong&gt;Amount per hour&lt;/strong&gt; is now calculated for the summary values, not as average of jobs.&lt;/p&gt;
&lt;p&gt;You can use any of the following predefined aggregate functions within the QuickReports Designer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Avg()&lt;/strong&gt; - Returns the average of all values in the expression.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Count()&lt;/strong&gt; - Returns the number of values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CountDistinct()&lt;/strong&gt; - Returns the number of distinct values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Max()&lt;/strong&gt; - Returns the maximum value across all records.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Min()&lt;/strong&gt; - Returns the minimum value across all records.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sum()&lt;/strong&gt; - Returns the sum of all values.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: reporting, Analytics, summary, quickreports, calculated fields&lt;/div&gt;
</description></item></channel></rss>