SSRS Matrix report. Variance expression by Month. Need to compare month from prior year to current month of current year VS2010
Please help. I have a matrix report. In the report I have row group PO Type. One the Column groups I have a parent group by Fiscal Year, and then a child group by Month. When I run the report, I get two years of data back broken
out by month. Please see below.
Now here is where I am getting stuck. I need to take the variance between the current month of the current year, from the same month of the prior year. So I need to show the difference between Oct , 2014 from Oct, 2013. November, 2014 from November
2013... etc. etc.
In the example below, how do I create a column or row showing the variance for Contracts for October 2014. I need to take the contracts for October 2014 which is 3 and subtract that from October 2013 which is 8. Any suggestions? How do I do that
for each month? Then I need to do it for the quarter... then the year? But I'll be happy if I can just get the month working first.
Any help will be appreciated.
here is what my rdl file looks like.
Here is what my report looks like when I render it.
Hi Adrian_s2012,
According to your description, you want to compare values for the month of current year with the month of prior year and get the variance. Right?
In Reporting Services, we don't have any function to get this "Year to Year" Growth. In this scenario, if you data source is a cube, we suggest you use Analysis Services to achieve your requirement. If this data source is just from database, it will be hardly
to calculate the variance because we need to compare the values within every two different column group and matrix generate adjacent columns one by one. Even we make it by using custom, every time executing the long code when generating result
in a cell will reduce a lot of performance, we really don't suggest to do that in SSRS. Here is a thread with much easier requirement, please take a reference of that:
http://social.msdn.microsoft.com/Forums/office/en-US/842e2dcb-d949-4297-9d91-eac989692cb5/difference-between-the-grouped-column?forum=sqlreportingservices
If you have any question, please feel free to ask.
Best Regards,
Simon Hou
Similar Messages
-
SSRS Matrix report to show or hide year column based on parameter value "Date" selected.
Hey experts!
I have a requirement an ssrs matrix report should display columns (year/s) based on parameter value (date/s).
My Dataset fileds are: Product, Year_name, Month_name, Date
Currently my report output looks like this-
Param Date: 2013-08-01 00:00:0.000
Product +Calender2011 +Calender2012 -Calender 2013........ +Calender2014
Total
Total Jan13 Feb 13 Mar13.. Dec13 Total Total
Abc 100
220
10 20 30....... 20 250 400
Xyz 110
200 50 80 40....... 30 450 600
My requirement: if I'm selecting Date parameter value as '2013-xx-xx' I should only able to see Year column 'Calender2013' and rest of the years should hide. Similarly If I'm selecting Date parameter value as '2014-xx-xx' I should only able to
see Year column 'Calender2014' .
Appreciate your kindly help.
AfanHi Afan,
According to your description, you want to only show the selected year on your report, right?
In this case, you need to get the year from the date parameter using the expression below
=Year(Parameters!Date.Value)
And then use the expression below to get the year from Year_Name field.
=Right(Fields!Year_Name.Value,4)
Then add a filter to the dataset to filter the data like below
Expression:=Year(Parameters!Date.Value)
Operator:=
Value:=Right(Fields!Year_Name.Value,4)
Reference
http://msdn.microsoft.com/en-IN/library/dd255287.aspx
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support -
Column limit in SSRS Matrix report being uploaded to Report Manager in SQL2008 R2
Hi,
I am getting this error :
SQL Server Reporting Services
Error
The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible
version.
I am attempting to upload my SSRS Matrix report to Report Manager. The report has a lot of columns (109 row columns followed by the variable number of column columns).
After trial and error, I discovered that when I only have 107 row columns I can upload successfully.
Can anybody explain why this is happening? Is there a limit of 107 columns?
Thanks,
GRusteanAs there was too much nesting in the tablix inside the report. We added new tablix and shifted some rows to that tablix. Because maximum of 36 level nesting is allowed in tablix
-
Please see below matrix report before and after I run. How can I find percentage of below marked fields,
for example: 1/3=0.33 (%33) Female(PAs)/Total(PAs)=?
Erdal HuzmeliHi Erdal,
According to your description, you have a matrix report and you want to get percentage of two different column in this report. Right?
In Reporting Service, we can’t just use ReportItem function or aggregation function with scope string to calculation when we are working in a matrix because the columns of matrix are dynamic. So we need to define some functions in custom code and do calculation
by calling those functions. Your scenario has been tested in our local environment. Here are some steps and screenshots for your reference:
Add the custom code below into your report:
Dim Shared Num1 As Integer
Dim shared Num2 As Integer
Public Function GetPA(PA as Integer, Type as String)
If Type = "Male" Then
Num1=PA
ELSE If Type="Female" Then
Num2=PA
End If
Return PA
End Function
Public Function GetMalePct()
Return Num1/(Num1+Num2)
End Function
Public Function GetFemalePct()
Return Num2/(Num1+Num2)
End Function
Ps: We notice that Total PA=Male PA +Female PA. So we use “Num1+Num2” in the functions that we define in the custom code instead of using “SUM(Fields!PA.Value)” in expression.
Put the expression below into the PA textbox in Gender group:
=Code.getPA(SUM(Fields!PA.Value),Fields!Gender.Value)
Put the expression below Female textbox within Gender Percentage:
=Code.getFemalePct()
Put the expression below Male textbox within Gender Percentage:
=Code.getMalePct()
Save and preview, the matrix and result looks like below:
Reference:
Custom Code and Assembly References in Expressions in Report Designer (SSRS)
How to calculate the Percent change in a dynamic
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
How to Substract Adjacent Columns in SSRS Matrix Reports
Hello Experts!
Month 2005
2006
January 648343.8132
May 733248.3506
June 587549.2014
July 259933.2074
623172.5646
August 501182.4458 513690.3892
I have a report like this and i want to show the o/p like
Month 2005 2006 2005-2006
January 648343.8132 648343.8132
May 733248.3506 766248.3506
June 587549.2014 587549.2014
July 259933.2074
623172.5646 363239.3572
August 501182.4458 513690.3892 12507.9434
Tried using Previous Function but it is not working for Matrix Reports i.e. Overlapping Columns
Tried Custom Code like
Public Shared previous as Integer
Public Shared current as Integer
Public Shared Function GetCurrent(Item as Integer) as Integer
previous=current
current=Item
return current
End Function
Public Shared Function GetPrevious()
return previous
End Function
I've taken the Column Insert Column-->Insert Group-Right and in that i written the expression as
=Code.GetCurrent(fields!Score.Value) & "-Previous-" & iif(Code.GetPrevious()=0,"",Code.GetPrevious())
Still it is not working
Please help me regarding this
Thanks & Regards
VIJAYHello RSINGH,
Previous Function is not working Matrix Report. So i written the expression like
=SUM(Fields!Sales.Value)-Previous(SUM((Fields!Sales.Value)))
The result is is subtracting Row wise but i want to subtract Column Wise i.e. 2006 Jan-2005 Jan & 2007 Jan-2006 Jan & 2006 Feb-2005 Feb so on...
but with the above expression it is showing 2005 feb-2005 Jan and 2005 Mar-2005 Feb and son on -
SSRS Matrix Issue. Expression calculating in row with no data.
I have a matrix with multiple column groups for different sales channels. With in each group there are several columns and some with expressions for calculations. The rows are based on sales reps. Now not every sales rep sells in every channel, so there
are some columns in which a rep will have no data. I want them be blank or show a 0. I can do both of those. The issue I am having is in the expressions for reps that have no data, it is still showing a calculation. It seems to populate that cell with whatever
the first result of an actual calculation is. See below. For rep D and E they have no calls or sales in this particular sales channel; however, the closing ratio is showing 30.23% (which is the closing ratio for rep A). I need this to be blank or 0 or N/A,
anything other that a wrong %. I have tried numerous iif and isnothing statements, e.g. =iif(Fields!count_of_customers.Value = 0,0,Fields!count_of_customers.Value/iif(Fields!Calls.Value = 0,1,Fields!Calls.Value)) plus other i have found on the internet
but none of them work. Can someone please help? Sorry it is not a picture of the report. They need to confirm my account before I can attach pictures. But this is the set up of the report.
Figure A
Phone Field
Rep Calls
Sales Closing Ratio
Premium Rep
Calls Sales
A 1000
323 32.3%
$100,250 A
50 5
B 200
10 5% $50,000
B 0
0
C 300
15 5% $25,000
C 25
5
D 0
0 32.3%
$0 D
300 50
E 0
0 32.3%
$0 E
100 15
F 500
100 20%
$300,000 F
0 0Hi RobTencents,
After testing the issue in my environment, I can reproduce it. To fix this issue, please try to use the expression below to instead the original one:
=iif(sum(Fields!count_of_customers.Value) = 0,0,sum(Fields!count_of_customers.Value)/iif(sum(Fields!Calls.Value) = 0,1,sum(Fields!Calls.Value)))
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Hi,
I have a table with the following attributes : item, location, value. I want to create a matrix report with items on columns, locations as headers and in the middle the correspondent values: the report should look like this:
item loc1 loc2 loc3
1234 200 300
2456 25 12
456 12 15 16
I know how to do the matrix report(I use a view based on the table) but my question is related to a performance problem. As the view contains a lot of data (more than 2mil. records), my question is how the matrix report is being build( I need to know if it does a self-join with the same view to build it, as this might take a long time to generate the report).
In case I use a parameter for location(for example I want to generate a matrix report but only for loc1) it will take a long time as well?
ThanksTry to avoid too much of regrouping in layout, have your xml structure in desired format. Also try enabling scalable mode
-
How to deploy SSRS 2008 reports to Sharepoint 2013.
Hi,
Can some one guide me how to deploy SSRS 2008 reports to SharePoint 2013 by giving the exact steps from where to begin. We have all our reports deployed in SharePoint 2010.Need to migrate those reports to Sharepoint 2013 instance. I
also want to know how and where exactly we modify the connection strings to manage the data sources for the reports . Since I am very new to this field I am not able to properly understand other sites i have gone through . I have gone through the prerequisites
also.Kindly help me by providing step by step method.
Thanks,
MridhulaIf you don't just want to upgrade your database, simply open the report project (which should be on your local file system) and edit the report properties, changing the Report Server URLs appropriately to the new SharePoint server URLs.
Trevor Seward, MCC
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Matrix report with group.
dear all,
can anyone guide me how to build a matrix report with group using scott schema.
i can not be able to build a query.
Thanks
Muhammad NadeemThe example given by Oracle (from the above link) using the following SQL for a matrix report is flawed.
SELECT DEPTNO, JOB, SUM(SAL)
FROM EMP
GROUP BY DEPTNO, JOB
ORDER BY DEPTNO, JOB
The SUM function handled by the query restricts you from doing so many things - especially when you want the empty fields to be filled by 0 (by using the Value if Null property).
If the query is changed to ''SELECT DEPTNO, JOB, SAL FROM EMP' , and use the SUM function in the wizard to build the Matrix cell, then the 'Value if Null' property can be used without any issues.
This also makes Section 25.6 (Add zeroes in place of blanks) of the documentation a joke.
Anyway, that's my cents worth.... -
Group matrix report with an hierarchy table???
Hello,
I have a big trouble making up a report involving many tables and one of them having a many-to-many recursive relationship. The user has a defined request in having the information grouped.I'll give some more details. I would like to know if you have any ideas in how to structure the report..
Here are the tables:
ORG
(org_id not null,
org_name not null)
DNR
(dnr_id not null,
org_id not null,
dnr_age,
dnr_gender)
CS
(cs_id not null,
dnr_id not null)
Smpl
(smpl_id not null,
dnr_id notnull,
org_id,
smpl_tp not null,
cs_id,
meth,
notes)
Tr_map
(tr_id not null,
smpl_prnt not null,
smpl_chld,
pos)
Some data..
Smpl_id Dnr_id Org_id Smpl_tp Cs_id Meth Notes
107 101 137 tss a xxxx
118 112 137 tss ab xxxx
122 108 25 tss 3768 a xxxx
123 108 25 tss 3768 ab xxxx
124 108 25 blk c yyyy
125 108 25 sld d zzzz
126 108 25 blk c yyyy
tr_id Smpl_prnt Smpl_chld Pos
1 107
2 118
3 122
4 123
5 124 122 1
7 125 124 1
8 126 122 1
10 125 126 2
The user wants the data reported as follows:
Org name
Dnr_id, dnr_age etc...
Cs_id
Smpl_id, Smpl_tp (tss), Meth, Notes
Smpl_id,smpl_tp(blk), Meth, Notes ...
Smpl_id, smpl_tp(sld), Meth, Notes...
Cs_id
Smpl_id, Smpl_tp (tss), Meth, Notes
Smpl_id, smpl_tp(blk), Meth,Notes...
Smpl_id, smpl_tp(sld), Meth, Notes...
I think the grouped matrix would be the solution but I don't know how to do that with the hierarchy table to show the children and grandchildren as subgroups. Is that possible in a single query? How can I build a group matrix with multiple subgroups?
Thanks in advance.
simona
nullThe example given by Oracle (from the above link) using the following SQL for a matrix report is flawed.
SELECT DEPTNO, JOB, SUM(SAL)
FROM EMP
GROUP BY DEPTNO, JOB
ORDER BY DEPTNO, JOB
The SUM function handled by the query restricts you from doing so many things - especially when you want the empty fields to be filled by 0 (by using the Value if Null property).
If the query is changed to ''SELECT DEPTNO, JOB, SAL FROM EMP' , and use the SUM function in the wizard to build the Matrix cell, then the 'Value if Null' property can be used without any issues.
This also makes Section 25.6 (Add zeroes in place of blanks) of the documentation a joke.
Anyway, that's my cents worth.... -
Hello,
I am using VS2010 shell. I have a matrix report where I have a row group by Year. Then I have a column group by Month.
When I run the report, I get 2013 data on top of 2014 data. Now I need to create a variance by year for each month.
So in the example below, I need to create an expression that will pull the variance for Oct 01... subtracting 2013 from 2014 for the months. So I need to Subtract 8,222 - 4290. I have no clue.
Here is what my rdl looks like.
Thank you for your help.Hi Adrian,
If I understand correctly, you want to calculate the difference order between 2013 and 2014 for every month. And there are only two years in the FISCAL_YEAR field.
If in this scenario, we can simply use the following expression to achieve your requirement:
=first(Fields!ORDER.Value)-last(Fields!ORDER.Value)
The following screenshot is for your reference:
If there are any misunderstanding, please elaborate the issue for further investigation.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Hello, Expert,
Could you please help me with the following problem? Thanks in advance!
I have designed the matrix report (SSRS 2012) with database table structure looks like below.
Week
Version
Count
Week1
V1.1
4000
Week1
V1.2
4000
Week1
V1.3
4000
Week2
V1.1
3000
Week2
V1.2
3000
Week2
V1.3
3000
Week3
V1.1
2000
Week3
V1.2
2000
Week3
V1.3
2000
Week4
V1.1
1000
Week4
V1.2
1000
Week4
V1.3
1000
The matrix report displays like below. Column grows based on no of Week in the table.
Week1
Week2
Week3
Week4
V1.1
4000
3000
2000
1000
V1.2
4000
3000
2000
1000
V1.3
4000
3000
2000
1000
What I want to do now is: instead of the Count values, I need to calculate the percentage of each week over the
Count in Week1 so that each cell displays Count(Week2)/Count(Week1), Count(Week3)/Count(Week1), etc. What is the SSRS expression for that? I’m new to SSRS, Please help!Heidi,
Thank you so much for your reply and solution! Now I know how to get the first field in a group. But I can't apply your solution directly just yet because in order to explain my problem I simplified my data structure. My real data structure has a nested
group like this:
Week VersionMajor VersionMinor Count
Week1 V1 V1.1 2000
Week2 V1 V1.1 1500
Week3 V1 V1.1 800
Week1 V1 V1.2 1000
Week2 V1 V1.2 500
Week3 V1 V1.2 200
Week1 V1 V1.1 2000
Week2 V1 V1.1 1500
Week3 V1 V1.1 800
Week1 V1 V1.2 1000
Week2 V1 V1.2 500
Week3 V1 V1.2 200
Here is the query for the above data:
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
And my matrix table looks like this:
What I need to do is to calculate the percentage of each week over week1 for
1) V1 Total
2) V1.1
3) V1.2
I can't use your solution directly because I need to apply Sum function for each cell and the Sum function gives me error when I try to use it on the denominator
First(Fields!Count.Value,"VersionMinor"). If you could help me further to get to the final solution, I'd really appreciate it!!
Happy New Year! -
SSRS 2005 - Dynamically control the width of columns in Matrix report or Hide any column
Hi All,
I just want to hide some column without having white space in Matrix report in SSRS 2005. Although I am aware of that perhaps this feature is not available on SSRS 2005. So, I just want to know if we can handle the width of column dynamically(using expressions)
in matrix report?
Please help. Thanks in Advance.
Regards
KumudHi Kumud,
Based on my test, SSRS is not support column dynamically width. It has property “CanGrow” of text box. If we configure the property to True, it will wraps to next line if needed. In SSRS 2008, we can hide some columns without white space. If possible, I
recommend you update your SSRS 2005 to SSRS 2008.
There is a similar issue, you can refer to it.
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/9e6043f1-c458-4540-be59-d37b02feab8a/dynamic-column-width-for-a-report?forum=sqlreportingservices
Alternatively, I recommend you that submit a wish to the Microsoft Connect at
https://connect.microsoft.com/SQLServer/Feedback. Your feedback is valuable for us to improve our products and increase the level of service provided.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
How to calculate percentage and difference of two values in matrix report in ssrs 2008
Hi everyone,
DB--SQL server
SSRS-2008
I am creating matrix report with grouping on WEEK and Fiscalyearweek,
I need to calculate of difference between FY14W01,FY15W01 ande percentage of those..
how to calculate in ssrs level.
Thank You, Manasa.VHi veerapaneni,
According to your description, you want to calculated the increment percentage and difference between two fiscal year week within each week. Right?
In this scenario, since we need to do calculation based on values between dynamically generated cells, we can't simply use expression to achieve this goal. In this scenario, we need to use custom code to record the value for fiscal 14 and fiscal 15, then
we can calculate the difference and percentage within the column group. We have tested your case in our local environment, please refer to the steps and screenshots below:
1. Add the custom code below into the report (you may need to modify the data type based on your scenario:
Public Shared Value1 as Integer
Public Shared Value2 as Integer
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
If product =previous and Week =previousweek Then
Value2=Value
Else
previous=product
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetPct()
return (Value2-Value1)/Value1
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
2. Design the matrix like below:
3. The result look like below:
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Calculate percentage between two rows in a matrix report with a single row group in SSRS 2008
I need your help. I have a matrix report in ssrs 2008. The report contain one field value column and one value column. I need to calculate a percentage for two values. For example : row 1 : Discount 10 Row 2 : Sales 100 Result : 10/100. I have only one
row group, I need to have a condition where Field = Discount % on Revenue then Discount/Total Turnover. Because of the grouping for total, I am not being able to calculate the %, its just totalling the % discount. Kindly refer to the snapshot of the
report.Hi Thanks a lot for your answer, but unfortunately it didn't work,the report is reading from a stored procedure which I have unpivot to convert all columns into rows, so that's why Discount % on Revenue, Discount and Total Turnover is found in one column.
So the Field!Col.Value is the Discount % on Revenue, Discount and Total Turnover. I have tried to change the code to
"=SUM(IIF(Fields!Col.Value = "Discount",Fields!value.Value),0))
/IIF(SUM(IIF(Fields!Col.Value = "Turnover Total",Fields!value.Value),0)) = 0 ,
Nothing,SUM(IIF(Fields!Col.Value = "Turnover Total",Fields!value.Value),0)))" but to no avail. Any other suggestion will be most welcome.
Thanks.
If everything you're getting from stored procedure then you need to calculate and bring the value from there itself.
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page
Maybe you are looking for
-
How to embed excel in java bean area on oracle forms 9i?
Hi, I am trying to embed excel in oracle forms 9i using java bean. I want to open excel sheet in the bean area not as seprate application. Means i donot want to excel running separately from forms on the machine. If any body knows the solution please
-
Validation problem with dependent selectOneChoice
Hi, I have two af:selectOneChoice box. Both have valueChangeListener. 1st box will load the value in 2nd box and the 2nd box listener has some logic for rendering other component. Required and immediate attribute are true for both the box. Now if I c
-
Anyone using a AR XSight Touch Remote w/ATV?
I'm trying to integrate my ATV (gen1) system into my home theater setup so I don't have to have a gaggle of remotes next to me to control all my devices. So far I have everything pretty much integrated and I can access my Mitsubishi DLP TV, My Panas
-
Movie icons don't get a preview on the desktop like jpegs do.
Hi, I have .jpeg, .wmv and .mov files on my dektop and have set up the desktop so that all icons get a preview pic. But only the jpegs seem to show the preview pic. The movie files simply show a white and blue 'Q movie' icon. Sometimes they show the
-
Help needed in installation of SM
Hi I installation of SM in my system can any 1 tell me the steps what i have do aft that?(configation part) Regards, Swaroop