SSRS Expression - Show last 30 Days from Today, without changing SQL Query - sql-server

I have 3 tablix, each on one page. The first tablix shows result for months, the second tablix shows result for weeks and the third tablix for each day.
Now I want to limit the day-view to the last 30 days. Otherwise, it's just to much information.
The current expression for the date is =Fields!Date.value
Is there a way to limit the day-view to show only the last 30 days from today without changing my SQL query?
Thanks in advance.

Setup a filter on your tablix:

Related

Create a column within an SSRS Report to sum values based on conditions of previous column

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.

SSRS using Subtract Function in Filters

I am creating a report that shows the performance on a monthly basis.I have historic data from 200101. When I create and preview the report all data shows from 200101 to most recent month.
I want to limit the number of months to be the most recent 13 months.
I tried using this expression
=max(Fields!month.Value)-13
This doesn't work and shows an error.
What about a DATEADD() function? (If I'm understanding your question)
=DATEADD(DateInterval.Month,-13,MAX(Fields!Month.Value))
Other option would be to filter the data out either in SSRS or your SQL.
The SSRS filter would use between TODAY and the DATEADD() function (=DATEADD(DateInterval.Month,-13,TODAY))
Or filter in your SQL:
WHERE Month BETWEEN SELECT DATEADD(MONTH,-13,GETDATE()) AND GETDATE
Ideally your expression should be
=max(Fields!month.Value-100-IFF(Fields!month.Value%100>1,1,88))
100 is for 1 year and 1 is for the month; 88 is actually 100-12 for the case when month is like 201701, then you'd need your value to be 201512 (going back 13 months)
For more checks, we do need to check that we do have 13 month data starting from 200101
=IFF(Fields!month.Value>200201,max(Fields!month.Value-100-IFF(Fields!month.Value%100>1,1,88)),200101)

How to Eliminate #Error Columns in Tablix Crosstab Group

Imagine a one-table query that accepts a year (range) as a parameter and then yields a dataset grouped by State, City, and Month, with a count of UFOs, if any, for each month.
Tie that dataset to an SSRS Tablix, with a crosstab layout:
The Row Groups are State, City;
The Column Group is the Month (Jan through Dec); and
The row-column intersections are the # of UFOs sighted, if any.
PROBLEM:
If I run the (parameterized) report for one location, even one with few sightings, all goes well: I see columns only for months with sightings.
However, if I report more than one location (say, "Albany," with daily sightings, and "Troy," with October-only), Troy's grouping will come out ugly: If reported alone, just the October column would show, but, now, October along with 11 columns of "#Error" for the month name and a "0" for UFO count appear.
I suspect that one solution may involve some 0- or NULL-fill of missing-month data for Troy and other cities (How?), but is there some other way, via the Tablix widget, to achieve the desired result?
I don't understand what you're doing wrong but the matrix usually works with filling the headers correctly and leaving blanks where there is no data for a single group.
It might help if you show your design view.
Design View:
Report View:
Many of the users don't have data for previous months but at least one does so the month is displayed in the header. The blanks are where there is no data for that month/user combo.
I don't see why your report isn't working like this. If I only selected one user, then only the months that user had will be displayed.

SSRS: 2008 run same procedure with diff params for multi month report

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.

Grouping by week and daily breakdowns in SSRS

I have a query concerning SSRS and displaying data. My report will consist of a weekly breakdown of week numbers and sum of hours. Showing something like this
12/06/10 351
19/06/10 342
26/06/10 399
And then on clicking/toggling the week data cell(s) a breakdown by day will be displayed. I have completed the daily breakdown and written a function to return all weeks in 2010 but my difficulty lies in grouping by the week.
In the layout tab for SSRS, I have created a group on the week value and date value, and have the week value appearing in the group cell, but it creates an additional blank line below each day breakdown.
Could anyone help me?
Thanks very much

Resources