I have created a matrix with the groupings below in SSRS 2008 R2 and SQL Server 2008 R2.
MembershipStatus has "New Enroll", "Term", "Active".
What I need to do is to add a row called "Other" to do the following calculation:
Last month new enroll + last month active – this month term – this month active
In the example below, it's
19,281 + 0 - 2,082 - 17,195 = 4
I've used temp tables and various combinations of APPLY to get the results I need in SQL, but due to the large number of parameter combinations, I really need to do it inside SSRS.
Should I just give up and code it in the CODE section of the report?
Any insight would be greatly appreciated.
Try using the ReportItems function. Each text box in SSRS will have unique name which can be found by selecting the respective text box and then checking the top most section in the properties window displayed on the right side.
Let's say your NEW ENROLL value for June is displayed in Textbox1, TERM FOR June in Textbox2, ACTIVE for June in Textbox3, NEW ENROLL FOR July in Textbox4, TERM for July in Textbox5, ACTIVE FOR July in Textbox6 and so on. Write the below expression for OTHER value for July as below:
=ReportItems!Textbox1.Value + ReportItems!Textbox3.Value - ReportItems!Textbox5.Value - ReportItems!Textbox6.Value
This formula will change based on the default naming by SSRS for the respective textboxes.
With the calculation provided, it only allows to do the calculation in the same month. The question is how to calculate numbers in the previous month against current month...
how could it be done?
Related
I am using a pivot table on Google Data Studio, which shows total income for each month of the year.
I wish to show total income for each month of the year, separated by years - for example, January 2017, and January 2018 will hopefully appear one above the other.
I attached an example that describes best what I need (couldn't find an explanation for how its built in the picture)
In the picture, the equivalent for "Years" is "Gender"
Figured it out. its just by adding another metric in the row dimension, missed it on the first try..
I have an ssrs report that shows revenues for each month of a year for several years based on start and end date parameters the user enters. What I would like to do is add a second column that shows the revenue for that quarter (march would show q1 revenue, june q2 etc). the problem I am having is that I am able to do this for a single year but once the query starts looking at multiple years my column shows the value for all 1st quarters regardless of year. The picture shows what I am currently getting. Any recommendations on how to fix my expression to also look at the year value when summing these quarters?
Here is the code I am using to only populate the quarter column based on the month.
=IIF(Fields!Sort_Order.Value=3,
Sum(Lookup(1,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(2,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(3,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=6,
Sum(Lookup(4,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(5,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(6,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=9,
Sum(Lookup(7,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(8,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(9,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),
IIF(Fields!Sort_Order.Value=12,
Sum(Lookup(10,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(11,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings"))
+Sum(Lookup(12,Fields!Sort_Order.Value,Fields!Calculated_Revenue.Value,"Bookings")),""))))
I ended up creating a quarter column within my data set that was then used as a parent group for the month rows. I then hid that column and added a total for the quarter that gave me sub totals. Not exactly what I was looking for but gave me the result I needed.
I want to add the formula in one of my column in SQL Server named (Day to due). The formula will calculate how many days the equipment to reach the due date. I have used the formula in the excel but it can work successfully.The formula is (DueDate cell - Today()).
So i want to implement the formula in SQL Server . Anyone can help about this?
Use DATEDIFF
in your example: DATEDIFF(day,GETDATE(),DueDate) AS Days_Until_DueDate
A negative date will indicate the number of days a project is overdue.
As per MSDN from Microsoft https://msdn.microsoft.com/en-us/library/ms189794.aspx
I'm all about recycling-)
I have report that user want to run for selected number of month back (let say from 1 to 12).
If they selected 6 month back (Jul-13 thru Jan-2104, then I need to produce 6 pages with monthly report on each of them, and sp is the SAME for all reports just different time params.
How I can reuse my code??
For now I have 12 Tablix(s) with New Page=START, Hide condition set based on datediff(m,startDate,endDate) individually for each Tablix.
Then I need to run same sp with diff params, can I add some dynamics into it? or I better to have 12 sp(s)?
Thanks
Mario
You can achieve this with a single dataset and a List Report Item with an embedded Tablix:
Set the List Grouping to Group/Sort first by: =Year(Fields!YourDateField.Value) and then by =Month(Fields!YourDateField.Value).
Set the Page Breaks on the List Grouping to "Between each instance of a group".
Drag your Tablix inside the List Report Item.
Let me know if you need more detail.
I am developing an SSRS 2008 report which contains a number of simple charts. On the x axis I have the 12 months of this year - Jan 2009 thru December 2009. On the Y is an integer value ranging from 0 to 100 in increments of 10. I am plotting the number of times an issue occurred per month. So January could have a value of 10, February 30, etc. etc.
I would like to have a horizontal line/series that is constant and shows the yearly average for 2008. So, say the average was 30 issues per month in 2008, I would like for that line to be shown in my chart. Basically, I want to draw a straight line across the chart for that value... I can see how to add more complex series, but this seemingly simple task is getting the better of me.
Doe anyone have any idea how this could be accomplished?
Thanks in advance,
Jason
[Update] To add some further details, I am already pulling the average for each row in my dataset and have it set up as its own series. However, rather than plotting a line, this approach plots individual points for each month. While this is close to what I want, I need to join the dots so to speak. The chart is of the Error Bar (Range) variety.
Can you use a column / line hybrid chart? If so then add a constant or dynamic target value to the chart:
Design the chart.
On the Data tab in the Chart Properties dialog box, add a new data value (for example, Target).
Set the target value (see the example in Figure 9 on link this uses a constant target value of 100000 across all categories but you can do it dynamically too). Make sure to use an expression starting with = (equals). Otherwise, the value is not interpreted as a numeric value.
See the example on the MS charts page at http://msdn.microsoft.com/en-us/library/aa964128.aspx
Add the yearly average to each row in the underlying the query. Add data series on just that value.
I managed to solve this issue myself.
As I mentioned, I was using an Error Bar graph. Right-clicking on the series of interest, I was able to change the graph type for that particular series - essentially leaving me with a chart with multiple graphs in it...particularly simple if you know where to look - which i did not! Thanks everyone for your suggestions.