Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Filtering a Cross Tab using Date Time field
Rosh 69
Hi Everybody,<br />
I want to apply date criterion to a crosstab in the report.<br />
<br />
For example, records created in the <strong class='bbc'>Last Month</strong>.<br />
Currently , in a table i use the 'Create Date' field in the filter where i have created two formuale :<br />
<br />
1. The first formula will make sure that the records are pertaining only to the current year :<br />
<br />
<span class='bbc_underline'>Formula :</span> <br />
<span style='color: #8B0000'>BirtDateTime.year(row["Dat_IssueCreatTime"])</span> <strong class='bbc'>In</strong><br />
<span style='color: #000080'>if(BirtDateTime.month(BirtDateTime.today()) == "January")<br />
{(BirtDateTime.year(BirtDateTime.addYear(BirtDateTime.today(), -1)));}<br />
else(BirtDateTime.year(BirtDateTime.today()))</span><br />
<br />
2. The second formula calculates the last month :<br />
<br />
<span style='color: #8B0000'>BirtDateTime.month(row["Date/Time Field"]) </span><strong class='bbc'>In</strong><br />
<span style='color: #000080'>BirtDateTime.month(BirtDateTime.addMonth(BirtDateTime.today(), -1))</span><br />
<br />
<br />
I tried to use the same formulae on the dimension 'Create Date' in the Crosstab, but the report gave an error saying : <br />
<strong class='bbc'>"org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report"</strong><br />
<br />
And yes, I am using <strong class='bbc'>Birt Designer 2.5.1 v20090903</strong><br />
<br />
Kindly advise if you have come across anything of similar sort.<br />
<br />
Regards,<br />
Roshan.
Find more posts tagged with
Comments
kclark
Would you mind if I took a look at the rptdesign?
Rosh 69
Hi kclark,
Attached is the .rptdesign file.
You can refer to filters used in the table. It works fine.
But, the same cannot be applied to crosstab.
Thanks.
Regards,
Roshan.
Rosh 69
Hi kclark,
Hope you are fine.
Did you have a look at the report file attached previously?
Regards,
Roshan.
Hans_vd
Hi Roshan,
Did you try to add the filter to the cube or to the crosstab itself?
Also, if you did it on the crosstab itself, did you do it step by step using the dialog or did you just copy/paste the condition in the expression builder?
Rosh 69
Hi Hans_vd,<br />
<br />
I have used the qualification on the crosstab and not the cube itself.<br />
<br />
Below is the qualification used : <br />
<br />
<br />
<span style='color: #8B0000'>BirtDateTime.month(data["Dat_IssueCreatTime"])</span> <strong class='bbc'>in</strong> <span style='color: #000080'>if(BirtDateTime.month(BirtDateTime.today()) == "January")<br />
{(BirtDateTime.year(BirtDateTime.addYear(BirtDateTime.today(), -1)));}<br />
else<br />
{(BirtDateTime.year(BirtDateTime.today()));}</span>
Hans_vd
Ok,
What happens if you remove that filter and instead apply it in the cube definition? In order to do this, press the "Filter" button next to the Primary dataset field in the Cross Tab Cube Builder.
Rosh 69
Alright, I will try that and get back to you with the result.
Thanks.