SSRS format total minutes into total HH:MM:SS - visual-studio

The current report expression presents the data in Days:Hours:Minutes:Seconds
=cstr(floor((sum(Fields!phoneInOutbound.Value) / 86400))) & " days " &
cstr(floor(((sum(Fields!phoneInOutbound.Value) Mod 86400) / 3600))) & ":" &
cstr(floor((((sum(Fields!phoneInOutbound.Value) Mod 86400) Mod 3600) / 60))) & ":" &
cstr(floor(((sum(Fields!phoneInOutbound.Value) Mod 86400) Mod 3600) Mod 60))
I am trying to get it to show total Hours:Minutes:Seconds.
So far I have only managed to get minutes:seconds using the following expression;
=cstr(floor((sum(Fields!phoneInOutbound.Value) / 60))) & " : " &
cstr(floor(((sum(Fields!phoneInOutbound.Value) Mod 60))))
Any idea how to reconfigure so I can get total hours:minutes:seconds?

Okay so your basically going to need to add the first statement (Where it originally gets days) plus the second statement (where it was originally hours). You can either change the first statement to get the days than days * 24 to get days back to hours THAN + 2nd statement. There's probably an easier way, not sure what your data set looks like or even what database your reading from. Just trying to get you thinking in the right direction.

If I was you I would handle it on sql side and just use ssrs as a place to hold the data. You can make this as easy or as complex you want. When I mean complex i mean you get the data from Minutes filed and then add "min" + seconds value + "sec" to it. By wrapping the whole thing in another named query and creating a calculated field. Personally not a big fan of leveraging SSRS for doing calculations as you are using report server's memory to do this (which should be used for reporting not handling calculations) BUT if this method is easy for you then more power to ya. Below is a sample code to handle this on SQL side.
create table #temp_time_test (
phoneInOutbound_IN datetime
,phoneInOutbound_OUT datetime
)
insert into #temp_time_test values
('11/06/2018 12:24:13.790','11/06/2018 12:34:13.790')
select DATEDIFF(MINUTE,phoneInOutbound_IN,phoneInOutbound_OUT) from #temp_time_test

Related

migrate querie update in sybase to oracle

hi guys i need migrate this querie to oracle
UPDATE t_tel
SET fec_hora = convert(datetime,substring(date_call,1,8) + " " + hour_init)
I know very little about the database, pls help.
Here's what I think (I don't know Sybase so I looked at documentation; it would be simpler if you explained what you want to get as a result based on input (i.e. DATE_CALL and HOUR_INIT values).
Therefore, a presumption:
date_call looks like a date, where first 8 characters represent day, month and year - but I don't know in which format so I presumed it is ddmmyyyy. If it is not, you'll have to use correct format
hour_init contains time - again, format is unknown, so I presumed it is hh24mi
If that's so, you'd
update t_tel set
fec_hora = to_date(substr(date_call, 1, 8) || ' ' || hour_init,
'ddmmyyyy hh24mi'
);
Format mask ddmmyyyy hh24mi might need to be changed if source data looks differently.

Using Power BI Desktop, how can I present Time Duration in a matrix that converts it to decimal?

I have Begin Date and End Date in my data file (Excel), then in PowerQuery I add a column where I simply subtract the Begin Date from End Date to create a new column "Import Time", change the result's data type to Duration and in PowerQuery, the column correctly shows the difference expressed in Day:Hour:Minute:Seconds. However, in a report, I need to show the average not of an entire column, but of groups of values in a matrix based on the entire table. In other words, I'm looking for a table that shows columns for Category Name, Avg. Duration and Max Duration, with rows showing the results for each unique Category.
The problem is that when I drag a table field in to the Visualizations Value area and change to Average, it expresses the result as a decimal, and I can't figure out how to show the date / time equivalent. I thought I might have to multiply by 3,600 since the result might be shown in milliseconds, but that didn't work. Any thoughts?
So I theorized that perhaps the issue wasn't one with Power BI, but perhaps with how Microsoft expresses date / time computations. I edited my Excel file that contains the source data and computed the "Import Time" by subtracting Begin Time from End Time. By default, it displays in date / time format of "hh:mm:ss.0000". I then asked Google and came across a simple explanation: to express a date / time in numeric format, you need to multiply the date / time by 24 (hours), 60 (minutes) and 60 (seconds) if that's how you wanted to express the result. I then created a Pivot Table summarizing the average of the Import Times and saw the same thing I did in my Power BI report, which is when it clicked it for me.
To solve the issue, I edited my Power Query step to compute the import time and included " * 24 * 60 * 60" in the formula. After updating the report, the results matched what I saw in Excel and I'm good. Hopefully this helps others to deal with this vexing issue.
You wrap your averaging measure in a FORMAT function to convert it to precisely the text format you want to show in your matrix. For example, suppose your raw output is
Group AvgDuration
------------------
A 0.0633
B 0.2733
C 0.0600
These numbers are in the unit of days, so you can convert to hours, minutes, or seconds like this e.g.:
FORMAT ( [AvgDuration] * 24, "0.00h" )
FORMAT ( [AvgDuration] * 24 * 60, "#,0m" )
FORMAT ( [AvgDuration] * 24,* 60 * 60, "#,0s" )
FORMAT ( [AvgDuration], "hh:mm:ss" )
(where [AvgDuration] is your measure you use to calculate the average)
Those last two should look like this:
Group AvgDuration
------------------
A 5,472s
B 23,616s
C 5,184s
and
Group AvgDuration
------------------
A 01:31:12
B 06:33:36
C 01:26:24

Openedge syntax for TIME minus 4 hours

I am trying to figure out how to write a Openedge query where i can look back 4 hours. i have struggled with the TIME syntax before. If i understand correctly, the TIME representation in Openedge is in seconds starting from midnight. The query i am trying to write would run 4 times a day, looking back 4 hours.
Is there any way to do this using TIME? Maybe i have to write 4 different queries that only pull records starting at a specific time?
Thanks very much for any help i can get, it is greatly appreciated!
Martin
You don't describe the contents or layout of the table very well.
Yes, TIME, in Progress ABL contains the number of seconds since midnight. So 16:20 for instance is 58800 (16 * 3600 + 20 * 60).
Assuming the field in your table contains an integer representing the time you can do like this to select the records that was created up to four hours ago:
DEFINE VARIABLE iTime AS INTEGER NO-UNDO.
/* I find it easier to write like this but you can very well do = TIME - 14400 instead */
iTime = TIME - 4 * 3600.
FOR EACH tablename NO-LOCK WHERE tablename.createtime >= iTime:
/* Do something */
END.
Note: perhaps you need to check create date as well? And handle midnight?
Another option might be to look at the DATETIME type. There you can do operations like adding and distracting an amount of time.
DEFINE VARIABLE datnow AS DATETIME NO-UNDO.
DEFINE VARIABLE datthen AS DATETIME NO-UNDO.
datnow = NOW.
DISPLAY datnow.
datthen = ADD-INTERVAL(datnow, -4, "hours").
DISPLAY datthen.

Duration format in google spreadsheet

I'm trying to apply a duration format to some cells in google spreadsheet. I would like to convert an integer number in a format: X days x hours x minutes.
I've tried with some formats like: d:h:mm but i found a problem when I apply the format. It always put one day less. When I write 1 in the cell the convert to 31:0:00. When I write 2 the cells changes to 1:00:00.
That is because the duration format is actually a date / time format (for comparing dates).
If you simply enter a number (1) google will interpret that as midnight (as times are stored as fractions of whole days) of the reference day number 1.
Reference day in Google Sheets is 31/12/1899 - IE the 31st day of the month. That is why your result returns days=31.
To achieve what you want you effectively want to add 1 to your values. so that 1 (+1) actually becomes "2 days since 31/12/1899 - ie 01/01/1900 - ie 1 day, and you could then use custom format for display, but this wont work when you have >31 days.
I think the best way is to simply concatenate the data you have with relavent parts like so (where A1 is a cell containg your data - 1,2,1.5 etc):
=int(A1)&" days "&int(MOD(A1,1)*24)&" hours " & mod(MOD(A1,1)*24,1)*60 & " minutes"

SSRS Charts displaying time greater than 24 hours

I have a time field in seconds (where the seconds is always greater than 86400) and I've been using the following formula to display the time in HH:mm:ss in a Tablix:
=Floor(Sum(Fields!SecondsField.Value) / 3600) & ":" &
Format(DateAdd("s", Sum(Fields!SecondsField.Value), "00:00"), "mm:ss")
When I try to plot this field using a bar chart (and using the same formula for the series formula), no data is displayed and was wondering if you had any ideas how to get around this?
Ideally this time field will be on the Y-axis.

Resources