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)
Multiple groups using same data value
Elja
<p>Hello.</p>
<p> </p>
<p>I'm trying to figure out the best way to create a Birt report with several groups using the same data field as their source.</p>
<p> </p>
<p>The idea is to count aggregate sums for several field values from DB and organize these values by different age groups (for example: how many customers are there of age 1-6). I'd like to count all the different report values by age groups like 0 years, 1-6 years, 7-14 years of age etc.</p>
<p> </p>
<p>I tried creating several groups for different ages and one tested using several filters inside one group but it seems that using the same data field for several groups isn't that straight forward to accomplish. I've had also difficulties to find the answer from the net..</p>
<p> </p>
<p>I'll attach a sample excel screen shot about the result I'm trying to acchieve.</p>
<p> </p>
<p>Birt version is 4.5.0.</p>
<p> </p>
<p>Thanks in advance, Elja</p>
Find more posts tagged with
Comments
micajblock
<p>Create a computed field for age group and then group on the computed field. Set the sort order of the group to be the age (so 15-18 will not be before 7-14)</p>
Elja
<p>Hello mblock and thanks for your advice.</p>
<p> </p>
<p>I looked into the computed field -option before but couldn't quite get the hang of it.</p>
<p> </p>
<p>So, could you help me a bit more with this approach:</p>
<p> </p>
<p>* Is the computed column created in the main Data Set?</p>
<p>* What would be the Aggregation type for it?</p>
<p>* Where do I create the age -ranges? In Computed columns Expression with some kind of If -case formula?</p>
<p> </p>
<p>- Elja</p>
micajblock
<p>Can you provide sample data as CSV and I can build a quick example. BTW what is the source data?</p>
Elja
<p>Hey mblock.</p>
<p>I'll try to produce a csv file out of my basic model of the report (I've mainly been trying to solve this issue).</p>
<p> </p>
<p>We're using postgreSQL DB.</p>
<p> </p>
<p> -Elja</p>
micajblock
<p>I attached an example using Classic Models. Ideally you use a case statement in the query (as I did). Alternatively you can create a computed field on the data set (I added this column but I am not using it). The aggregate would be whatever you need it to be.</p>
<p> </p>
<p>Hope this helps.</p>
<p> </p>
Elja
<p>Hey mblock and sorry I didn't manage to produce the csv file during work day.</p>
<p> </p>
<p>Thank you so much for the example report. I'll check both variations of the solution.</p>
<p> </p>
<p>I have to admit I've got to dig deeper into computed field. I thought the aggregation was compulsory.</p>
<p> </p>
<p>- Elja</p>
Elja
<p>OK now.</p>
<p>I was a bit unsure how the age group values would show in report (with the main group grouping on computed column age group).</p>
<p> </p>
<p>But it seems to work really nicely. I think I'm able to create the report based on this approach (I'll try the computed version first).</p>
<p> </p>
<p>Thanks a lot, once again and have a nice weekend.</p>
<p> </p>
<p>- Elja</p>
micajblock
<p>You're very welcome. </p>
Elja
<p>Hei mblock, another question aroused..</p>
<p> </p>
<p>I did some more testing with the computed field -approach.</p>
<p> </p>
<p>It seems that while I get the grouping going OK (first column shows the age group), and the aggregate function counts the rows fine (second column), it still adds the "empty rows" in between the age groups.</p>
<p> </p>
<p>I tried to suppress duplicates from column properties - Advanced for both columns, but it seems to work for only the first 2 age groups.</p>
<p>First row in excel shows "0" and second "1-6", but the third age group "7-14" is on the third excel sheet..</p>
<p> </p>
<p>Any ideas what would be an effective way to compress the values? I don't need any data row info, just aggregate count of sum values based on the age groups..</p>
<p> </p>
<p>- Elja</p>
micajblock
<p>There is the easy way and the right way. Easy way to to delete the detail. Simpy select the whole detail row by clicking on the place holder on the left and click delete.</p>
<p> </p>
<p>The right way is to create a table with 'Auto Summarize On'. Just create a new table and then you will have option to check 'Auto Summarize On'. This method just creates a more efficient design. With tables in this mode there are no detail rows.</p>
Elja
<p>Thanks again mblock.</p>
<p> </p>
<p>I got it working with both solutions. I'll get back to this reports development as soon as I'll get the former report working correctly.</p>
<p> </p>
<p>- Elja</p>
Elja
<p>Hey again, mblock.</p>
<p> </p>
<p>I'm wondering how could I use a computed field in joint data set for grouping..</p>
<p> </p>
<p>With one data set I could choose the computed column to group on, but in joint data set (regardless whether I've created it in one of the original data sets OR directly to the joint data set, the computed column is not on the list of the possible Group on fields..</p>
<p> </p>
<p>Is this somehow off the limits or have I done something wrong?</p>
<p> </p>
<p>- Elja</p>
Elja
<p>Oh, it seems that after I placed it in the report table it appears as a value in the grouping properties!</p>
<p> </p>
<p>- Elja</p>
micajblock
<p>Yes, it needs to bound to the table before you can use it.</p>
Elja
<p>Ok! Thanks for clarifying it.</p>
<p> </p>
<p>- Elja</p>
Elja
<p>Hey Mblock, I've still got a question:</p>
<p> </p>
<p>I have to create a joint table (combining 2 different data set info). Earlier you mentioned about ditching the detail row by either deleting it OR "creating a table with 'Auto Summarize On'.</p>
<p> </p>
<p>Is it possible to use the the auto summarize table -option with joint table? Or do I simply use the detail-row deletion in this case..</p>
<p> </p>
<p>- Elja</p>
Elja
<p>.. and another question following:</p>
<p> </p>
<p>It seems that just hiding the visibility of the detail row works fine.</p>
<p>
BUT: How could I make all the age groups visible? Even if there were no rows in the report related to the specific age group, I'd like to show them all in the report..</p>
<p> </p>
<p>- Elja</p>
micajblock
<p>Yes, setting visibility works but it is not efficient as the content gets created. As far as your other requirement. You can create a scripted data source with the list and create another joined data set with an outer join.</p>
Elja
<p>Thanks again for your help, mblock!</p>
<p> </p>
<p>- Elja</p>
Elja
<p>Hmm, sorry to return once again to this issue..</p>
<p> </p>
<p>Did you mean scripted Data Set or scripted Data Source? Any hints (more specific) how to proceed with this approach?</p>
<p> </p>
<p>- Elja</p>
micajblock
<p>Attached example. You will need both a scripted data set and data source. On the scripted data set look at the open and fetch events.</p>
Elja
<p>Thank you again, mblock.</p>
<p>
I'll look into this approach.</p>
<p> </p>
<p>- Elja</p>