## Percentage Calculation in Metrics Report.

 Author Message sunitarani19 Forum Newbie Group: General Forum Members Points: 1 Visits: 0 Hi All, 12/3/2013 12/4/2013 Measure value percentage value percentageFailed 100 percent 1 200 Delivered 100 percent 2 200 Unknown 100 percent 3 200 Total 300 600 i have a metric report as above and need to calculate the percentage.The Dataset has the following fields - Measure and Value.percent 1 should be calculated as failed/(Unknown+Total) i.e 100/(100+300)Percent 2 should be calculated as delivered/(Unknown+Total) i.e 100/(100+300)Percent 3 should be calculated as Unknown(Unknown+Total) i.e 100/(100+300)This is a metric report not a tabular report.Help Please.ThanksRani Attachments report.JPG (18 views, 26.00 KB) Mark Fitzgerald-331224 SSCertifiable Group: General Forum Members Points: 5149 Visits: 1655 This is a common requirement, to calculate the percentage of total given a list of values.The normal calculation would be : Percentage of Total = ThisValue / TotalYour calculations look strange as the Unknown value is included twice (once in the total and once where you use the Unknown+Total as the divisor).Given the normal requirement in a matrix (columns are Date, Metric and Value).1. Add the matrix to the report as normal (gives 2 by 2 grid)2. Drag the Date column onto the first row, second column. This will repeat for each date and gives a column group called Date which will be used later.3. Drag the Metric column onto the second row, first column. This will repeat for each metric and gives a row group called Metric.4. Drag the Value column on the second row, second column. The expression will be =SUM(Fields!Value.value)5. Test the report shows the values in the correct way.6. In design mode, right click the Value cell and choose to Insert Column inside group to the right. This will be the cell for the percentage.7. Right click the new cell and choose to add an Expression, as below. This would give the total for the complete Date (refers to the column group name).=SUM(Fields!Value.value) / SUM(Fields!Value.value, "Date")8. Format the cell to percentage.9. Right click the Date column heading and choose to Insert Row inside group below. Split the new cell that is created. Name the headings Value and Percentage.DoneFitz(Measure and Percentage.txt is a example RDL) Attachments SampleReport_output.png (21 views, 4.00 KB) Measure and Percentage.txt (13 views, 27.00 KB) MMartin1 SSChampion Group: General Forum Members Points: 11114 Visits: 2034 You can also include the percent/ratio in your sql query and pass it as a column to the report via the result set. Example ::USE ADVENTUREWORKS2008R2;GoSELECT personType, count(*) as Total, round( (cast(count(*) as float)/ (SELECT count(*) from person.person) ),3)*100 as PercentOfTotalfrom person.personGroup by personTypeThis can help you get started. Make sure count(*) > 0 :-D ----------------------------------------------------How to post forum questions to get the best help

## Permissions

 You can't post new topics. You can't post topic replies. You can't post new polls. You can't post replies to polls. You can't edit your own topics. You can't delete your own topics. You can't edit other topics. You can't delete other topics. You can't edit your own posts. You can't edit other posts. You can't delete your own posts. You can't delete other posts. You can't post events. You can't edit your own events. You can't edit other events. You can't delete your own events. You can't delete other events. You can't send private messages. You can't send emails. You can read topics. You can't vote in polls. You can't upload attachments. You can download attachments. You can't post HTML code. You can't edit HTML code. You can't post IFCode. You can't post JavaScript. You can post emoticons. You can't post or upload images.

##### Select a forum
 SQL Server 2016      SQL Server 2016 - Administration      SQL Server 2016 - Development and T-SQL SQL Server 2014      Administration - SQL Server 2014      Development - SQL Server 2014 SQL Server 2012      SQL 2012 - General      SQL Server 2012 - T-SQL SQL Server vNext      SQL Server 14 - Administration      SQL Server 14 - Development SQL Server 2008      SQL Server 2008 - General      T-SQL (SS2K8)      June 2007 CTP      Working with Oracle      July CTP      SQL Server Newbies      Security (SS2K8)      SQL Server 2008 High Availability      SQL Server 2008 Administration      Data Corruption (SS2K8 / SS2K8 R2)      SQL Server 2008 Performance Tuning Cloud Computing      SQL Azure - Development      SQL Azure - Administration      Amazon AWS and other cloud vendors      General Cloud Computing Questions Reporting Services      Reporting Services      Reporting Services 2005 Administration      Reporting Services 2005 Development      Reporting Services 2008/R2 Administration      Reporting Services 2008 Development      SSRS 2012      SSRS 2014      SSRS 2016 Programming      Connecting      General      SMO/RMO/DMO      XML      Service Broker      Powershell      Testing      TFS/Data Dude/DBPro      SSDT      Continuous Integration, Deployment, and Delivery      R Services and R Language Data Warehousing      Integration Services      Strategies and Ideas      Analysis Services      Data Transformation Services (DTS)      Performance Point      Data Mining      PowerPivot      R language      Machine Learning Database Design      Disaster Recovery      Design Ideas and Questions      Relational Theory      Hardware      Virtualization SQLServerCentral.com      Anything that is NOT about SQL!      Contests!      Editorials      SQLServerCentral.com Announcements      SQLServerCentral.com Website Issues      Suggestions      Tag Issues with Content      Podcast Feedback      SQLServerCentral.com Test Forum      Articles Requested SQL Server 2005      Administering      Backups      Business Intelligence      CLR Integration and Programming.      Data Corruption      Development      Working with Oracle      SQL Server 2005 Compact Edition      SQL Server 2005 General Discussion      SQL Server 2005 Security      SQL Server 2005 Strategies      SS2K5 Replication      SQL Server Express      SQL Server 2005 Performance Tuning      SQL Server 2005 Integration Services      T-SQL (SS2K5)      SQL Server Newbies SQL Server 7,2000      Administration      Backups      Data Corruption      General      Globalization      In The Enterprise      Working with Oracle      Security      Strategies      SQL Server Newbies      Service Packs      SQL Server CE      Performance Tuning      Replication      Sarbanes-Oxley      T-SQL      SQL Server Agent SQL Server and other platforms      MySQL      Oracle      PostgreSQL      DB2      SQL Server and Sharepoint Older Versions of SQL (v6.5, v6.0, v4.2)      Older Versions of SQL (v6.5, v6.0, v4.2) Career      Certification      Employers and Employees      Events      Job Postings      Resumes and Job Hunters      Presentations and Speaking      Retired Members Testing Center      Question of the Day (QOD)      SQL Server Security Skills Microsoft Access      Microsoft Access Products and Books      Third Party Products         CA         Extreme Technologies.         Innovartis         Embarcadero         SQL Sentry         Sonasoft         SQLCentric         Golden Gate Software         Lumigent         Red Gate Software         Quest Software         ApexSQL         Idera      Discussions about Books         Discuss Programming Books          Discuss XML Books          Discuss T-SQL Books          Discuss Data Warehousing Books          Discuss DTS Books          Discuss SQL Server 7.0 Books         Discuss SQL Server 2000 Books Notification Services      Administration Article Discussions Future Versions      SQL 12