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)
Cross table - Grouping does not work
Miss_Anonymus
<p>Hello,</p>
<p> </p>
<p>I've done a report in Birt 4.4 with the follwing SQL-Statement as DataSet:</p>
<pre class="_prettyXprint _lang-">
SELECT ID, name, year,
CASE
WHEN year = 0 OR year IS NULL THEN 'no'
WHEN year != 0 THEN 'yes'
END AS 'was there?'
FROM table;
</pre>
<p>My result is:</p>
<p> </p>
<p><strong>ID name date was there?</strong></p>
<p>1 Lisa 2013 yes</p>
<p>2 Mary 2013 yes</p>
<p>3 Lisa 2014 yes</p>
<p>4 Lisa 2015 yes</p>
<p>5 Tom 2015 no</p>
<p>6 Mary 2014 no</p>
<p> </p>
<p> </p>
<p>My expected output in my report should be:</p>
<p> </p>
<p> </p>
<p><strong>name 2013 2014 2015</strong></p>
<p>Lisa yes yes yes</p>
<p>Mary yes no --</p>
<p>Tom -- -- no </p>
<p> </p>
<p> </p>
<p>I already tried to solve it with an cross table, but I have no idea how to bring the data in it, so that it aggregates as shown above.</p>
<p> </p>
<p>What can I do? Thanks already for your help!</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>An easy solution would be to create the "Was There" field as a integer instead of a string. For example, use 1 for Yes and 0 for No. In your data cube, you can create a Summary Field on "Was There" and use FIRST as the aggregation method. Then, in your crosstab, you can Map the Summary Field to display Yes when the value is 1, and No when the value is 0. You can also replace null values with "--" by entering this string in For Empty Cell field of the Empty Rows/Columns of the crosstab properties.</p>
<p> </p>
<p>I have attached an example that uses an Excel file as a data source. Simply unzip both files in your BIRT Project.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
Hans_vd
<p>As far as I know the FIRST aggregation can handle a string column, so no need to make the "Was There" field an integer</p>