Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
GrandTotal using time column
crrocha
<p>Hi all,</p>
<p> </p>
<p>It is possible to create a sum of a time column? For instance, I have a dataset with 3 columns (id, name and time) and I want to create a grand total of time in one table.</p>
<p> </p>
<p>Thanks.</p>
<p> </p>
<p><i>PS</i><em>.: I'm using BIRT 2.5</em></p>
Find more posts tagged with
Comments
micajblock
<p>Please define how one would aggregate time? How is it stored in the DB?</p>
crrocha
<p>I'm using SQL Server and I tried to create a sum of this query (It's just a example to simplify the question):</p>
<pre class="_prettyXprint _lang-sql">
SELECT 1 AS [Id], 'name 1' AS [Name], CAST('01:00' AS TIME) AS [TesteTime]
UNION
SELECT 2 AS [Id], 'name 2' AS [Name], CAST('02:00' AS TIME) AS [TesteTime]
UNION
SELECT 3 AS [Id], 'name 3' AS [Name], CAST('03:00' AS TIME) AS [TesteTime]
</pre>
<div>
<p> </p>
</div>
<p>And I want this output of report:</p>
<pre class="_prettyXprint _lang-">
Id Name TesteTime
1 name 1 01:00:00
2 name 2 02:00:00
3 name 3 03:00:00
Total 06:00:00 <~ sum all of the times
</pre>
micajblock
<p>Is the original field a date time and you are just displaying the time?</p>
crrocha
<p>Yes, the original field is date time and I just want to display the time and grand total of this time.</p>
micajblock
<p>You will need to use the BirtDateTime functions to calculate this. I think these functions were available in 2.5.</p>