Cross table with two datasets (one as the row and the other as the column) - birt

I have two datasets in my birt report :
Lesson (date)
Student (name)
and I would like to know how to create a cross table using the date (red) as the column names and name (blue) as the row names as shown below :
The cells will stay empty.
I have try to use the Cross Tab but it seems that I can only use one dataset.
For information I am stuck with the version 2.5.2. I say this in case someone writes about a practical functionality available in the later version of birt... :-)

Where both datasets are coming from the same relational data source, the simplest way to achieve this would normally be:
Replace the existing two datasets with a single dataset, in which the two original datasets are cross-joined to each other;
create a crosstab from the new dataset, with the new dataset columns as the data cube groups.

Related

Generate a 3 column table by flattening the given multi column table using google sheets formula

I want to generate a 3 column table by flattening the given multi column table using google sheets formula. The formula should scale to any sized input table.
The sample file is here
https://docs.google.com/spreadsheets/d/1qTvQ58hh1jJEMVWqhQ833jjDBpuudJambmvdJemESPI/edit?usp=sharing
I have tried with
={ARRAYFORMULA(B2:B6),ARRAYFORMULA(D2:D6)}
Disaggregating is not a simple process. You can do it in different ways. Here is one with REDUCE that doesn't involve joining and splitting process. I've moved your input chart some columns to the right so the formula is "scalable" to as many companies you may have:
=QUERY(
REDUCE({"","",""},SEQUENCE(COUNTA(D2:D)),LAMBDA(a,c,{a;
REDUCE({"","",""},SEQUENCE(COUNTA(F1:1)),LAMBDA(d,e,{d;INDEX(D2:D,c),INDEX(F1:1,1,e),INDEX(F2:1000,c,e)}))})),
"Where Col1 is not null",)
You may try:
=hstack(tocol(map(B2:B6,lambda(z,wraprows(z,counta(D1:I1),z))),1,1),tocol(bycol(D1:I1,lambda(z,index(text(SEQUENCE(counta(B2:B6)),"")&z))),1,1),tocol(D2:I6,,1))

Google Sheets Extract Data from Table and make a row per data set

I'm stuck with Google Sheets.
Situation:
I have a data table with projects. Each project as a few attributes, most importantly including which team member has worked on the project this month.
Goal:
I need to convert the data to a new table that is built up differently. I need one row per project per active team member.
Sample data and goal:
https://docs.google.com/spreadsheets/d/1QcNPsvHX8hBNUpCJiutof8yD8ukFYcCXM_pLNrQmDUs/edit?usp=sharing (can edit)
As you can see, SEO and Island now have two rows instead of one, as Jan AND Chris have worked on the projects this month.
Approach:
I tried FILTER, QUERY (with pivot) and thought about Scripting (basically its an iteration over the Matrix B3:E8...). However, I am not particularly skilled at Sheets and am very thankful for your help. Thanks a billion, guys!!!
You can do this a fairly standard way by using Textjoin to join together the corresponding column headers and other data for the non-blank cells, then separating it into rows then rows and columns with the Transpose and Split functions:
=ArrayFormula(split(transpose(split(textjoin("¶",true,if(B3:E8="","",A3:A8&"|"&F3:F8&"|"&G3:G8&"|"&H3:H8&"|"&I3:I8&"|"&B2:E2)),"¶")),"|"))

Can I combine datasets in Report Builder 3.0?

I have 3 different datasets. Each pulls from the same datasource, but each has different filters in order to pull data as of a different points in time (12/31/15, 12/31/14, and 12/31/13). Each dataset contains the fields: enum, gender, and YearEnd (YearEnd I created using an expression). Can I combine the data from all 3 datasets into one table or matrix. My ultimate goal is to create a chart to show trends over time, but I can't figure out how to combine the data. Since I have different filters for each, I believe I have to have 3 datasets. I just can't figure out how to append them all into one. Thoughts?
I believe your best bet would be one combined dataset instead of three. Create a dataset that gets you the data for all three dates.
You can filter for the rows you want (date in ('12/31/15', '12/31/14', '12/31/15')) in either your SQL query/stored procedure or in your dataset options (right click dataset, properties, filters).
You can also filter at the table level (right click the outside border of the table, tablix properties).
You can break up your table to show different dates using column and row groups, as defined with group expressions, and use expressions as well to display custom headers (2015, 2014, 2013)
I haven't done much with charts in Report Builder, but from looking at it it looks like you can use filters and groups much the same way.

how to set dynamic header using BIRT?

I am newbie to BIRT and unfortunately my first task is over complicated.
I want to create table like this
Birt Report Snap
the columns in this picture must be dynamic. the data for the column name is in database and I have to fetch it and create columns on the go. 2nd to put values against it.
kindly tell me if this thing is doable in birt. I am new to this so please don't give negative ratings
thanks.
I believe what you are looking for is called a Cross Tab Table.
Here is a tutorial video on it: BIRT - Cross Tab Table
In addition to SBurris answer, which is the way you should try first, I can assure you from my experience that what you want is in fact doable with BIRT, and even in two different ways.
However, some of the minor aspects might be a bit quite tricky for beginners, e.g. the merged cells in the column header, the different background colours and border widths for the columns. So, these style aspects shouldn't matter at first, you can tackle them later.
The first, by far easiest and standard way to achieve this kind of report layout is a cross tab, as SBurris said.
The second option is - depending on the database backend - to use a "normal" Table report item in they layout and to "create the cross tab" with SQL.
This is more powerful IMHO as the BIRT Cross Tab report item, but also more complicated.
For examples, see here:
Pivot / Crosstab Query in Oracle 10g (Dynamic column number)
Pivoting rows into columns dynamically in Oracle
How to do Pivoting in Oracle 10g
(you get the idea)
To use this with BIRT, you'll have to select the column title values in addition to the cell values.
You have to decide how many columns do/should fit on your page (if you're using PDF output).
You can use the maximum aggregate function in the visibility expression of the columns to hide empty columns.
If the number of logical columns exceeds the number of columns for a single page, you can extend the idea further by dividing the cross tab into several, each with at most N columns.
However, note that this approach will need an experienced BIRT developer...

Hive: How to have a derived column that has stores the sentiment value from the sentiment analysis API

Here's the scenario:
Say you have a Hive Table that stores twitter data.
Say it has 5 columns. One column being the Text Data.
Now How do you add a 6th column that stores the sentiment value from the Sentiment Analysis of the twitter Text data. I plan to use the Sentiment Analysis API like Sentiment140 or viralheat.
I would appreciate any tips on how to implement the "derived" column in Hive.
Thanks.
Unfortunately, while the Hive API lets you add a new column to your table (using ALTER TABLE foo ADD COLUMNS (bar binary)), those new columns will be NULL and cannot be populated. The only way to add data to these columns is to clear the table's rows and load data from a new file, this new file having that new column's data.
To answer your question: You can't, in Hive. To do what you propose, you would have to have a file with 6 columns, the 6th already containing the sentiment analysis data. This could then be loaded into your HDFS, and queried using Hive.
EDIT: Just tried an example where I exported the table as a .csv after adding the new column (see above), and popped that into M$ Excel where I was able to perform functions on the table values. After adding functions, I just saved and uploaded the .csv, and rebuilt the table from it. Not sure if this is helpful to you specifically (since it's not likely that sentiment analysis can be done in Excel), but may be of use to anyone else just wanting to have computed columns in Hive.
References:
https://cwiki.apache.org/Hive/gettingstarted.html#GettingStarted-DDLOperations
http://comments.gmane.org/gmane.comp.java.hadoop.hive.user/6665
You can do this in two steps without a separate table. Steps:
Alter the original table to add the required column
Do an "overwrite table select" of all columns + your computed column from the original table into the original table.
Caveat: This has not been tested on a clustered installation.

Resources