I have a dataset that contains data in below format: The graph you see on the right is a Line chart that is being used in SSRS report. This is the sample data you see in here below. The graph in SSRS report contains month wise data (as oppose to day wise here) I need to set the axis dynamically (Y-Axis numbers) so that when the numbers get changed the said graph is also updated without updating the Y-Axis manually.
I know I can set the vertical axis property of line chart and then go to "Minimum" and write an expression to bring minimum of one column but I am not sure how to handle MIN function for 3 columns (i.e. Under 5 years, 5-10 years and 10+ years)
TL;DR: I need to change vertical axis to bring MIN -5 values for Last 3 columns combined (in below chart) and MAX +5 values for again those columns. hence MIN should be -5 (i.e. 0-5) and MAX should be 48 (43+5)
I am assuming that setting the Y Axis min and max values to Auto does not work for your situation for whatever reason?
There may be a better way of doing this but this is what I thought of...
=
IIF(
IIF(
MIN(Fields!ColA.Value) < MIN(Fields!ColB.Value),
MIN(Fields!ColA.Value),
MIN(Fields!ColB.Value)
)
< MIN(Fields!ColC.Value),
IIF(
MIN(Fields!ColA.Value) < MIN(Fields!ColB.Value), MIN(Fields!ColA.Value),
MIN(Fields!ColB.Value)
)
, MIN(Fields!ColC.Value)
) -5
and...
=
IIF(
IIF(
MAX(Fields!ColA.Value) > MAX(Fields!ColB.Value),
MAX(Fields!ColA.Value),
MAX(Fields!ColB.Value)
)
> MAX(Fields!ColC.Value),
IIF(
MAX(Fields!ColA.Value) > MAX(Fields!ColB.Value), MAX(Fields!ColA.Value),
MAX(Fields!ColB.Value)
)
, MAX(Fields!ColC.Value)
) +5
Related
I'm stuck with a problem in SSRS 2012 that maybe is very simple:
I have a matrix with a group row (employee) and a group column (last 12 months); the values are COUNT(practicesDone) - i.e. the amount of practices worked.
I want the matrix to show an extra column on the right (after all the columns of the months, and clearly outside the column group) with again the number of practices for the current month.
Is it possible to achieve that?
thank you in advance!
You can do this, it's pretty simple.
I have assumed that your dataset contains a column that has a date for each entry and that the data returned only covers 12 months so the same month would not appear for different years. If your data does have multiple years, look at the second expression below.
Right-click your month column and then to "Insert Column --> Outside Group - Right"
Now set the expression for the text box to
=COUNT(IIF(MONTH(Fields!myDateColumn.Value) = MONTH(TODAY()), 1, Nothing))
You could swap COUNT for SUM and it should do the same thing but either will work.
All we are doing here is comparing the all data in scope which, due to the placement of the text box means the scope is the entire rowgroup. Then for all that data, check if the month matches the current month, if it does set it to 1 is not set it to nothing then count/sum all results. Count conveniently ignores 'nothing'.
If you data covers more than 12 months then you can still do this but you'll have to add a bit more to handle years and months like this.
=COUNT(
IIF(
MONTH(Fields!myDateColumn.Value) = MONTH(TODAY())
AND YEAR(Fields!myDateColumn.Value) = YEAR(TODAY()),
1,
Nothing
)
)
I am trying to calculate the difference in days between 2 data sets and then if the value is between 1 and 2 days then it should show compliant if the value is a negative number or greater than 2 days I want it to show non-compliant. I am not sure what I have wrong, it runs however they all show compliant
Background on the calculation needed.
IMM Discharge compliance - Hospitals must
deliver a copy of the signed notice to each beneficiary not more than two (2) days before the day of discharge. Follow-up notice is not required if delivery of the initial IM falls within two (2)
calendar days of discharge.
FYI - the first IFF statement is because some do not have dates so that was to account for those
=IIF(
IsNothing(Lookup(Fields!Account_Number.Value,Fields!Account_Number.Value,Fields!Intervention_Date_Of_Service.Value, "Interventions")),
"No Intervention",
IIF(
DateDiff("d",Fields!Actual_Discharge_Date.Value,Lookup(Fields!Account_Number.Value,Fields!Account_Number.Value,Fields!Intervention_Date_Of_Service.Value, "Interventions")) <=2,
"Compliant",
"Non-compliant")
)
I have tried multiple variations =1 or 2, etc if I use just the =2 they all show non-compliant
You have two conditions for non-compliance - the difference being negative or greater than 2 days so you have to check both conditions. Try something like this:
=IIF(IsNothing(Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")),
"No Intervention",
IIF(DateDiff(DateInterval.Day, Fields!Actual_Discharge_Date.Value, Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")) < 1,
"Non-compliant",
IIF(DateDiff(DateInterval.Day, Fields!Actual_Discharge_Date.Value, Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")) > 2,
"Non-compliant",
"Compliant"
)
)
)
Specifically the Interval Properties.
No matter what I do I don't get the desired result.
I need to color in 3 shifts of 8h each.
My Chart has the X-Values ranging from 0 to 23.
My earliest shift starts at 5am.
I get the length and offset of each shift through an SQL Query in minutes.
Example Shift 1:
offset = Datediff from 0 to shiftstart -> 300 min
length = Datediff from shiftstart to shiftend -> 480 min
My intuition tells me that since I have 24 X-Values in my chart, I need to set intervalType to hours or days with either 24 or 1 as value.
I interpret it as "Every Day/24h begin drawing the specified Stripline at its offset-Value with the specified length".
intervalOffsetType would be Minutes.
In my mind, the Offset works in conjunction with the selected IntervalType and since my shift starts at 5am each day, I suspect that intervalOffset needs to be 300.
Which would mean: "Begin drawing the stripline at 5am".
the striplineWidth-property then determines the the width, or rather length of the shift and its type, again, works in conjunction with the IntervalType.
Evidently this is not the case though.
My Settings:
My Result:
Can someone explain to me how the Interval Properties work?
I can't find any proper documentation on them either.
The solution to my problem was on the axis-options.
(rightclick x-axis -> properties)
Switching from category to scalar and setting the intervalType produces the desired result.
I'd need to test it further but for now I think having axis-type set to category applies the stripline to each member of a categorygroup in a chart.
I am using SQL Server Reporting Services 2016, I need some advice on the following statement I have in the top row of a Tablix in SSRS inside a textbox, the stament has a few expression within the text:
The total number of referrals received so far in this reporting period
is 1427. This is a -6% «Expr3» when compared to the 1518 received in
the same period of the previous reporting year.
In this example I would like «Expr3» to say "Decrease" because -6 is a negative number.
«Expr3» ---The issue I have is I need to work out <>, I would like to display either Increase or Decrease based upon the value of «Expr2», if «Expr2» is a positive number then I want this value for «Expr3» to show the word "Increase" and if «Expr2» value is a negative number then I want «Expr3» to show "Decrease".
Below my value behind the other expressions
«Expr1»
=Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod")
«Expr2»
= ((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
Is there an expression which can do this for me?
Thanks
Your expression for Expr3 should be something like this:
=IIf(
((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
>= 0,
"Increase",
"Decrease"
)
This expression assumes that you want to include 0% as an increase, that can of course be changed to fit your needs by modifying the >= 0.
If you are going to have the word "increase" or "decrease" after the percentage though, you may want to display the absolute value of the percentage -- this may just be semantics but it would be a little confusing to me to see a "-6% Decrease", as the double negative implies an increase. If you wanted to change that, just wrap Expr2 in the abs function like so:
=Abs(
((Code.Divide(
(Sum(Fields!ID.Value, "01_TotalReferralsInThisPeriod"))
,
(
Sum(Fields!ID.Value, "02_TotalReferralsInLastPeriod"))
))-1)*100
)
Take Datetime and give the half hour band it belongs to, irrespective of the date, just interested in the time.
There is as far as I can see, no time periods in SSRS, I need half hour time periods, that's 48 blocks in a day.
I would like to plot my data in bar chart,the interval for the bar width is along the x axis, the height is the occurrences on the y axis. I need an interval of half hour(the width of the histogram),I don't want to run some IIF/CASE statement, I would rather, convert the DateTime i have to a band on each row of data, what's the best way to output so I get half hour intervals along the X axis.
I don't want to run some IIF/CASE statement
By this I assume you mean you don't want 48 layers of IIF/CASE. Here's an SSRS expression that'll band a datetime just using a single IIF:
=DateAdd(DateInterval.Minute, 0-
IIF(Minute(Fields!DATETIMEFIELD.Value) <= 29, Minute(Fields!DATETIMEFIELD.Value), Minute(Fields!DATETIMEFIELD.Value) -30),
DateAdd(DateInterval.Second, 0-Second(Fields!DATETIMEFIELD.Value) ,Fields!DATETIMEFIELD.Value))
This removes the seconds from the time, and removes as many minutes necessary to get to the previous half-hour. You could likely use the same logic with different syntax as a column in your SQL query, if you prefer.
Use this calculated value for all the relevant parts of your SSRS chart.