

Forum Newbie
Group: General Forum Members
Last Login: Friday, May 2, 2014 12:58 PM
Points: 1,
Visits: 0


Hi All,
12/3/2013 12/4/2013 Measure value percentage value percentage Failed 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.
Thanks Rani




Hall of Fame
Group: General Forum Members
Last Login: Thursday, May 12, 2016 5:23 AM
Points: 3,557,
Visits: 1,498


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 / Total
Your 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.
Done
Fitz
(Measure and Percentage.txt is a example RDL)




Right there with Babe
Group: General Forum Members
Last Login: Saturday, March 19, 2016 1:53 AM
Points: 776,
Visits: 1,556


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; Go
SELECT personType, count(*) as Total, round( (cast(count(*) as float)/ (SELECT count(*) from person.person) ),3)*100 as PercentOfTotal from person.person Group by personType
This can help you get started. Make sure count(*) > 0



