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)
Grouping range of dates into new parameter
hannon565
I'm trying to group range of dates together using birt. Ament really sure how to do this but what is have is records for individual dates e.g. 9/8/2012 10/8/2012 but what I want to change it to is from 9/8/2012 to 15/9/2012 to be counted as a week and so on for rest of the weeks.
thanks for the help
Find more posts tagged with
Comments
kclark
If I understand the question correctly you can right click in your table > insert group > group on = Date (or whatever the data field is) > Interval = Day. From here you can select the range you want to be grouped together, 3 days, 5 days, 7 days, whatever you need. If you want a page break after each group you can select what your requirements are on the right of the insert group window.
bgbaird
I shamelessly stole this from the web:
function getWeekNumber(d) {
// Copy date so don't modify original
d = new Date(d);
d.setHours(0,0,0);
// Set to nearest Thursday: current date + 4 - current day number
// Make Sunday's day number 7
d.setDate(d.getDate() + 4 - (d.getDay()||7));
// Get first day of year
var yearStart = new Date(d.getFullYear(),0,1);
// Calculate full weeks to nearest Thursday
var weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7)
// Return array of year and week number
return [d.getFullYear(), weekNo];
}
hannon565
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="110416" data-time="1349968296" data-date="11 October 2012 - 08:11 AM"><p>
If I understand the question correctly you can right click in your table > insert group > group on = Date (or whatever the data field is) > Interval = Day. From here you can select the range you want to be grouped together, 3 days, 5 days, 7 days, whatever you need. If you want a page break after each group you can select what your requirements are on the right of the insert group window.<br /></p></blockquote>
<br />
Thats sort of what I want kclark but I want to put that info into a chart and rename the weeks to say WW 1 for work week 1 for 01/01/2012 - 07/01/2012.<br />
<br />
The way I was thinking of doing it, was writing bit of javascript to create new computed column for every week that would label it for its respective work week