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)
year vs year-1 comparison in birt cross tab
kumbare
<p>Hi,</p>
<p> </p>
<p>I have created simple Cross tab report which will display sales data for each year for client.</p>
<p> </p>
<p>consider attached example. I want to add comparison between a year with its previous year.</p>
<p> </p>
<p>could you please provide some example or link which can help me to achive it.</p>
<p> </p>
<p>Thank you in advance.</p>
Find more posts tagged with
Comments
Clement Wong
<p>Depending on your data source, <span>it might be best to return the data in that format with those comparisons. Otherwise, you will need to code your report design to make those calculations.</span></p>
<p> </p>
<p><span>With scripting, you will have a few options.</span></p>
<p> </p>
<p><span>Option 1: Make a copy of the original table to a global array, and then use a scripted data source to perform the calculations. Then, use the scripted data source for your table.</span></p>
<p> </p>
<p><span>Option 2: The end result of this looks <em>slightly different </em>that your screenshot, but essential has the same new columns. The attached example design was created in commercial BIRT iHub 3.1. Note the only difference between OS and commercial BIRT here is the use of the <strong>Static Data Source</strong> to quickly mimic your data without comparisons [Client, Years 2010-2012 and their values]). </span></p>
<p> </p>
<p><span>Create a computed column in your existing Data Set to save off the previous value. Initialize the variables in <em>beforeOpen </em>of the Data Set.</span></p>
<p> </p>
<p><span>Create a Data Cube and include a new measure using that newly created previous value computed column.</span> Then, create a Cross Tab using the Data Cube.</p>
<p> </p>
<p>
kumbare
<p>Thank you for your quick reply but i am not able to run this report in eclipse it is showing one error.</p>
<p> </p>
<p> </p>
<p>Could you please provide me rpt file in eclipse ?</p>
<p> </p>
<p>Is it possible to do it using "Relative Time Period" option ?</p>
Clement Wong
<p>Yes, it is possible as I see that Pierre answered the same question in the <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/35769-year-by-year-comparism/?p=137942'>other
thread</a>. I forgot that in BIRT 4.2, we added <a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/phoenix/project/notable4.2.php#jump_9'>Relative
Time Period for Crosstabs</a>.</p>
<p> </p>
<p>Again, by using Relative Time Period, the output (location of the previous year comparison) will look similar to my screenshot versus your first post's mockup.</p>