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)
Weeks in dates
khorsi
Hi everyone,
I am a little confused with the way weeks numbers are generated in crosstabs and charts.
In a cross tab I have a date group with the levels years>Months>WeekOfMonth>WeekOfYear...
29th,30th,31st of December 2012 is displayed as the week number 1 of 2012. Shouldn't it be the 53rd week of 2012?
am I missing something
Find more posts tagged with
Comments
kclark
Can you recreate this with the sample DB and post the rptdesign please?
khorsi
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="113113" data-time="1357752298" data-date="09 January 2013 - 10:24 AM"><p>
Can you recreate this with the sample DB and post the rptdesign please?<br /></p></blockquote>
<br />
Hi kclark,<br />
<br />
to reproduce it I had to add a table ints just to generate the date sequence<br />
<br />
CREATE TABLE IF NOT EXISTS `ints` (<br />
`i` int(11) DEFAULT NULL<br />
) ENGINE=MyISAM DEFAULT CHARSET=latin1;<br />
<br />
<br />
<br />
INSERT INTO `ints` (`i`) VALUES<br />
(0),<br />
(1),<br />
(2),<br />
(3),<br />
(4),<br />
(5),<br />
(6),<br />
(7),<br />
(8),<br />
(9);<br />
<br />
here is the report attached
kclark
I created a report with the classic models DB and the weeks showed correctly in my crosstab. I wasn't able to run your sample report.
khorsi
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="113154" data-time="1357857210" data-date="10 January 2013 - 03:33 PM"><p>
I created a report with the classic models DB and the weeks showed correctly in my crosstab. I wasn't able to run your sample report.<br /></p></blockquote>
<br />
thanks kclark for the reply<br />
<br />
I used mysql version of the classic models DB and added a table to be able to write a query which generates sequences of dates.<br />
<br />
I attach here what I get in the preview
kclark
It looks like it's correct you'd need to change the week in the crosstab by checking if the week equals 1 and the month is December then you could change it to week 53. You could open the expression editor for Week of Year and do something like this.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if(data["Month"] == "December" && dimension["Group"]["Week Of Year"] == "1") {
this.value = "53"
}</pre>
khorsi
<blockquote class='ipsBlockquote' data-author="'kclark'" data-cid="113158" data-time="1357878776" data-date="10 January 2013 - 09:32 PM"><p>
It looks like it's correct you'd need to change the week in the crosstab by checking if the week equals 1 and the month is December then you could change it to week 53. You could open the expression editor for Week of Year and do something like this.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if(data["Month"] == "December" && dimension["Group"]["Week Of Year"] == "1") {
this.value = "53"
}</pre></p></blockquote>
<br />
Thanks kclark.
kclark
You're welcome, let me know if you have anymore questions.
arish
<p>What about a Chart? It seems that with this issue of changing data value in crosstab the Chart doesnt work
.</p>
<p> </p>
<p>Is this a bug?</p>
<p> </p>
<p>Thanks!</p>
JFreeman
<p>Could you be more specific about how the Chart does not work?</p>
<p>Could you provide a sample report we can run that demonstrates the issue?</p>
arish
<p>Yes, I've attached a sample report I did.</p>
<p> </p>
<p>I've manipulated the <strong>data binding of Week of Year</strong> and after I've <strong>sorted the crosstab by week of year</strong>.</p>
<p> </p>
<p>Until there I have no problems.</p>
<p> </p>
<p>But if I want a Chart with the Crosstab data i have a error and the Chart is not rendered.</p>
<p> </p>
<p>Thanks!
</p>
JFreeman
<p>I believe the issue you are facing is due to performing your calculations on the data binding which means the values are not available to the chart in time for its rendering.</p>
<p> </p>
<p>Instead, you can create a computed column for year and another for week of year. Then create the crosstab based on these versus the date column.</p>
<p> </p>
<p>Take a look at the attached modified version of your example for reference.</p>
arish
<p>Thanks JFreeman!,</p>
<p> </p>
<p>I didnt think in this posible solution.</p>
<p> </p>
<p>you are very kind
</p>
JFreeman
<p>I'm glad I could be of assistance.</p>
<p>Let us know if you have any additional questions.</p>