SSRS Convert Seconds to MM:SS Without Truncating - reporting-services

I am formatting average handle time as mm:ss but it seems to be truncating. I viewed the articles that came up under questions that may have your answer, none of them are working for my situation.
I am using Microsoft Visual Studio 2015, designing SSRS reports.
The calculation is currently using the format function.
The value displayed is 05:30. The actual value should be 05:31.
Numbers in the calculation:
2,354,739 EmailHandleTimeTotal
7,119 EmailsTotal
Value in seconds = 330.7682
Code:
=Format(DateAdd("s", Sum(Fields!ID_EmailHandleTimeTotal_.Value) / Sum(Fields!ID_EmailsTotal_.Value, 0), "00:00:00"), "mm:ss")
Looking for help displaying the result as 05:31 please.
Thank you

Just round the seconds, for example like this:
=Format(CDate("00:00:00").AddSeconds(Round(Sum(Fields!ID_EmailHandleTimeTotal_.Value) / Sum(Fields!ID_EmailsTotal_.Value))), "mm:ss")

Related

SSRS2016 Convert seconds to hh:mm:ss format

I have a table with a column, Duration that has value in seconds.
In Visual Studio / SSRS 2016 I want to display it in HH:MM:SS format.
I have tried to use the following expressions
=Format(DateAdd("s", Fields!Duration.Value, "00:00:00"), "HH:mm:ss")
But it didn't seem to work correctly, for example, 1800s will be displayed as 01:38:00
Can anybody see the problem?
Thanks!
To convert a number of seconds to time format use the TimeSerial function:
=Format(TimeSerial(0,0,Fields!Duration.Value),"HH:mm:ss")
The problem with your way might be that it is not implicitly converting from the text string to time format as you expect, so the following may also work:
=Format(DateAdd("s", Fields!Duration.Value, TimeValue("00:00:00")), "HH:mm:ss")

#PERCENT with a Map in SSRS 2008

I am using SSRS 2008 R2 and have the following map.
In my opinion, it looks very ugly with all of the zip codes showing for each area so what I would like to do is only show the zip code when the area has more than 10% of the total number of people in it. I was reading here (Troubleshooting Reports) so I don't know if this is possible. A coworker was telling me that for Charts/Graphs in SSRS there is a #PERCENT that would allow me to do something like:
Visibility Expression: =#PERCENT > 10
but I couldn't get it to work. Any help would be appreciated!
I actually did something extremely similar once. I ended up just setting the label expression using a couple of aggregate functions:
=IIF(SUM(Fields!Quantity.Value)/SUM(Fields!Quantity.Value, "DataSet1")>0.10,Fields!ZIP.Value,"")
Worked fairly well.

Need Savings totals by month to pull data correctly and display in Chart

My data and this SSRS chart have a ton of problems, I'll try to keep my question(s) succinct.
First, as you can see by this chart and this screenshot of my data (just showing date and April Savings), my expression/chart is not summing all of the savings within a month, which is my goal.
It appears to be picking one amount within the correct month and using it. I set up a tool tip for April so I could see what number it's pulling (since clearly the chart columns are not representing the data whatsoever - another issue).
You'll see in the SQL data screenshot that it does indeed pull $1,230 from the April 2013 Savings. How can I get this to Sum within the month AND still do a running value from the beginning of time data began to current, this often will include multiple years.
Here's my Chart Data (note that my Team Goal works perfectly, and is even charted correctly - but if anyone knows how to force that line to go from end to end on my chart, feel free to let me know.) :
To summarize, how can I sum each month's data, while still do a running value across the months AND years?
Here's my Expression for Implementable Savings:
=RunningValue(Sum(Fields!ImplementableSavings.Value), Sum, nothing)
(obviously if I can get one working, I can get both)
My Expression for ImplementedSavingsMonth:
=MonthName(Month(Fields!ImplementedSavingsDate.Value))
My Expression for ImplementedSavingsYear:
=Year(Fields!ImplementedSavingsDate.Value)
Let me know if there's anything else I can provide.
Quick sidebar question: WHY does my chart column collect one piece of data. IE: see the tool tip $1,230 for April 2013), but the chart column displays that the number is around $1.7M? And in this scenario, both of my blue and yellow columns are displaying the same number, so why does blue always appear to be a higher number? I will ask this as a 2nd question if it's inappropriate for me to ask here.
I would use this Expression for Implementable Savings:
= RunningValue ( Fields!ImplementableSavings.Value, Sum, "Chart1")
.. assuming your Chart's name is Chart1.

SSRS 2005 line graph Series / Interval

Afternoon all,
I have a simple bar graph in SSRS 2005 that displays data in a web page. The space that i have allocated on the web page is very small but is required.
I have a report that pulls data back for the last 24hrs and plots this on a graph. I have placed 'Timestamp' data on to my graph and it is located at within the 'Drop category fields here' section.
As the space that i have for my chart is only small the 24hr timestamp labels look too busy and look messy. Is there a way i can format this area so it only displays a label on the 6th, 12th, 18th and 24th interval?
I have reduced the label already by formatting the timestamp using the below but think i need to reduce the number of labels for the timestamp.
=Format(Fields!TimeStamp.Value, "H:mm dd-MMM")
Regards
Bet
Try looking at the Major gridlines interval:
Which gives me a result with some junk data:
So it might not be 100% perfect for what you want, but hopefully will be helpful. Unfortunately SSRS 2005 charts are a bit limited in functionality so it's a case of trying to do the best with what you have.

SSRS: Summing TimeSpan values in a report

I have a report and a datasource where one of the columns are of type TimeSpan. The TimeSpan value appears to display correctly in the report when I use Fields!TheTime.Value, no problem there.
07:02:00
05:41:00
But I would like to do a Sum on those values to get the total time of a group. In C# and such I can of course do a TimeSpan + another TimeSpan, so I know they can be added. I tried
=Sum(Fields!TheTime.Value)
But it ends up printing out as a long number of some sort. For example for the outputted times above, I would get 457800000000 as the sum. And what is that even supposed to be?
Anyways, how can I sum timespan values in a report? For the above timespans I would like to end up with 12:43:00 as the sum. Unless my head failed me at math once again... but you get the idea :p
sigh The solution annoyingly simple... Why couldn't I just have tried that in the first place? Oh well... maybe because I didn't realise I had access to TimeSpan class... maybe because I had thought myself blind... But anyways, here it is:
=TimeSpan.FromTicks(Sum(Fields!TheTime.Value))
D'oh!
#Svish - I deleted my previous post because I had a fit uncertainty about my answer but I concur with #pfunk.
I finally got SSRS back up and had a play around and it certainly looks like your big number is the number of ticks so it looks like a bit of formatting of the result will work for you.
Interestingly enough my previous convoluted answer was a workaround for summing DateTime values (using SQL Server DATETIME datatype in my query) which you cannot do in SSRS (and SQL) because you cant sum a DATETIME. I'll include it here again for future reference but I think was on a bit of a tangent earlier :)
The below code converts a DateTime field into a double, sums the result and then converts it back to DateTime and formats it for hh:mm:ss
=Date.FromOADate(Sum(Fields!TheTime.Value.ToOADate())).ToString("hh:mm:ss")
What is probably happening is that when you display Fields!TheTime.Value, SSRS is smart enough to know to display that as a DateTime type field
when you add the sum in there it thinks it is a numeric type field and displays it as such (ie, it is summing the number of "ticks" in each timespan field)
try specifically formatting the summed value as a datetime in the field properties and it will probably show correctly