SpagoBI Tutorials (Business Intelligence Step by Step) - OLAP, Datamining, Reporting, Charts, Qbe, Cockpits
SpagoBI Tutorials (Business Intelligence Step by Step) - OLAP, Datamining, Reporting, Charts, Qbe, Cockpits
SpagoBI Tutorials (Business Intelligence Step by Step) - OLAP, Datamining, Reporting, Charts, Qbe, Cockpits
com/
Creating BIRT report with SpagoBI Meta and SQL Server 2012 (hĴp://www.scribd.com
/doc/141104627/Creating-BIRT-report-with-SpagoBI-Meta-and-SQL-Server-2012)
Below is a tutorial on how to use the powerful SpagoBI business intelligence software to discover
paĴerns hidden in data to beĴer target your customers, perfom recruitment e.t.c. This is a step by
step tutorial of how to use the K-means algorithm to analyze 2.4 million records and publish the
results in SpagoBI. View the tutorial here hĴp://www.scribd.com/doc/138088742/SpagoBI-Data-
Mining-With-Weka-and-Oracle (hĴp://www.scribd.com/doc/138088742/SpagoBI-Data-Mining-With-
Weka-and-Oracle)
1 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
In this chapter, we will be creating a dashboard using the BIRT reporting engine and then we will
host it in the SpagoBI server.
Assume that the bank Shemma Global Limited gave out loans to 10 individuals with the account
numbers 1-34-100-100-100 to 1-34-100-100-109. The loan was to be paid after duration of 48 months
and was taken on December 2010. The first repayment period therefore was on 31st January 2011. We
will follow the payment for these individuals for duration of one year.
1. January 2011 – On the month of January 2011, everybody made their loan repayment which for
illustration purposes we will assume is 0.19% of the total loan amount per month.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0041.png)
From the figure above, we can see that the column not_paid is zero for everyone for the month of
January. If this column have a figure, then the loan will be in arrears.
2. On the month of February, some of our clients had difficulty paying their loans as illustrated
below.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0052.png)
For subsequent months, we had several defaults. We need to create a dashboard using the BIRT
reporting engine and SpagoBI that will show the following details.
2 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
1. Start your SpagoBI Studio and create a new report project. Call it Dashboard.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0061.png)
c. Under project name, enter Dashboard and click on use default location.
3 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0072.png)
d. Click on Finish.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0082.png)
b. For the parent folder, select Dashboard and enter non_performing_loans. rptdesign as the file
name.
4 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0092.png)
c. Click Next.
5 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0102.jpg)
e. Click Finish.
3. Now let us add a grid with four rows and two columns to our report. A grid is a row/column
layout that helps you organize items in your report. Under the pallete tab, click on report items, click
on the grid icon and drag it to your report.
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0112.png)
4. For number of rows select two and number of columns select four.
6 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04
/image0122.png)
5. We will insert the company logo on the first cell. Click on the image icon under pallete and drag it
to the first cell. Under “Select image from”, check the radio buĴon next to “Embedded Image” and
click on “Add Image”. On the CD that came with this book, you will find the folder images. Inside it
you will get shemmalogo.jpg. Select this image and click on insert.
(hĴps://spagolabs.files.wordpress.com/2013/04
/image0132.jpg)
6. Click on the Shift key as you drag the image to resize it proportionately. Now we will a heading on
the report. Click on the second cell on the right and drag the Text icon to it from the Pallete.
7 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0141.jpg)
7. Click on OK.
8. Click on the first cell of the second row then press down shift key and click on second cell on
second row. All the cells should be highlighted. With the cells in this state, right click and select
merge cells.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0151.jpg)
9. Click on background and change the background color of the merged cells and reduce the size to
five pixels.
8 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image016.jpg)
10. Once we are done with the heading, it should look like this.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0171.jpg)
Now we will add the first item that pulls data from our table on the chart. This will be the “total
monthly loan repayments that have not been paid expresses as a line chart to show trends for the
entire year “.
Note: In case you are reading this at spagolabs blog, then you can get the mysql dump and other
files needed for this tutorial by writing the author at the email xogutu at gmail dot com for a
small fee.
a. Under Data Explorer tab, right click on Data Sources and select New Data source.
9 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0182.png)
Click Next.
10 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0191.png)
g. Next we need to create a data set. Right click on Data Sets then select New Dataset.
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0201.png)
11 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0211.jpg)
j. Click Next.
k.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0232.png)
Under Query Text, enter the following sql and click on Finish.
12 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0241.jpg)
(hĴps://spagolabs.files.wordpress.com/2013/04/image025.jpg)
13. Merge the cells on row three and drag the chart icon from the pallete to the mergerd cells.
13 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0261.jpg)
15. Under Select Data, click on the radio buĴon next to “Use Data From” and select
“RepaymentTrend” data set.
14 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0271.png)
15 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0281.jpg)
18. Now if you check keenly, you will notice on the chart preview the chart is nor ordered properly
by month. To order click on “Edit Group and sorting buĴon” next to “Category (X) series”
(hĴps://spagolabs.files.wordpress.com/2013/04/image0291.png)
(hĴps://spagolabs.files.wordpress.com/2013/04/image0301.png)
21. Click on Next. Under format chart tab, click on series and remove the text “Series 1” and type
“Loan Arrears”
22. Click on Title and replace the text “Line Chart Title” with “Monthly loan arrears”
16 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0311.jpg)
24. Now click on Run -> View Report -> In Web Viewer, so that we can see how our dashboard looks
so far.
(hĴps://spagolabs.files.wordpress.com/2013/04/image032.jpg)
We can see from this that the month of SEP had the greatest amount of loan arrears. Now let us add
other components to our dashboard.
25. Next we will create a chart to show the top five defaulters as at current month which is
December.
a.
(hĴps://spagolabs.files.wordpress.com/2013/04/image034.png)
We will use the query below to calculate the top five defaulters.
b. Create a new data set using the query above and call it “Top5Defaulters”
17 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0351.jpg)
Expand the row below the one that contains the monthly loan arrears chart and insert a bar chart on
the cell labeled top 5 below.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0361.jpg)
c. Under use Data from, select Top5Defaulters. Drag the months_defaulted to Value (Y) series and
acctno to Category (X) Series a shown below. Click on Next.
18 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0371.jpg)
d. On the format chart Tab under legend, uncheck the visible check box.
f. Under X-Axis, click on the icon below to invoke the font editor.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0381.png)
19 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04
/image0391.png)
h. Click on Y-Axis and select the check box under title. For the title insert the text “No of defaults last
12 months”. For the title of the X axis, insert “Account No.”
i.
(hĴps://spagolabs.files.wordpress.com/2013/04/image041.png)
Next we will add the the total loan defaults per month on our chart using the query below.
Create a new data set and call it “Monthly Defaulters” using the query above.
j. Drag the data set “Monthly Defaulters “ to the cell on the right of the one with the Top 5 defaulters
chart. Modify it to look like the one shown below.
20 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image042.jpg)
k.
(hĴps://spagolabs.files.wordpress.com/2013/04/image044.png)
Create a new data set and call it “ArrearsList” using the sql below.
l. Drag the dataset “ArrearsList” just below the datagrid we used above.
(hĴps://spagolabs.files.wordpress.com/2013/04/image045.jpg)
21 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image046.jpg)
n. Our dashboard should now be complete. Click on Run -> View Report -> As PDF to export your
report to PDF.
(hĴps://spagolabs.files.wordpress.com/2013/04/image047.jpg)
22 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image048.jpg)
Follow the steps in chapter four to add the birt report to SpagoBI. Now you should have enough
knowledge to follow the SpagoBI documentation to create any object.
Posted in SpagoBI, SpagoBI Lessons | Tagged Actuate Corporation, Big data, BIRT, Business
intelligence, Dashboard, Pay-Per-Click Advertising, Promotion, Web Design and Development | 8
Comments
APRIL 25, 2013 BY SPAGOLABS
23 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
BIRT
BIRT is the acronym for Business Intelligence and Reporting Tools and is an open source initiative to
create a fully functional reporting tool using open source tools. BIRT supports various types of
reports such as lists, charts, crosstabs and compound reports. In this chapter we will learn how to
create BIRT reports and how to publish them in SpagoBI server.
Note: In case you are reading this at spagolabs blog, then you can get the mysql dump and other files
needed for this tutorial by writing the author at the email xogutu at gmail dot com for a small fee.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0012.jpg)
(hĴps://spagolabs.files.wordpress.com/2013/04/image0032.png)
24 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image004.jpg)
c. Click Next.
d. Under project name use “Business Intelligence”. For the storage location, use default.
e. Your new project will now be visible on the navigator on the boĴom left of the page.
(hĴps://spagolabs.files.wordpress.com
/2013/04/image005.jpg)
(hĴps://spagolabs.files.wordpress.com/2013/04/image006.png)
25 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com
/2013/04/image007.jpg)
b. For the report template, select blank report and click on finish.
26 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0081.png)
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0091.png)
4.
27 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0111.png)
Reports can get their data from various sources such as flat files or relational databases.
We need to create a connection to the database from the SpagoBI Studio. Proceed as shown below.
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0121.png)
b. Select JDBC Data Source, and on Data Source Name put “Mysql Local”
(hĴps://spagolabs.files.wordpress.com/2013/04/image0131.jpg)
28 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image014.jpg)
Change the URL, username and password appropriately. Click on Test Connection. This should be
successful before you proceed.
(hĴps://spagolabs.files.wordpress.com/2013/04/image015.png)
Click on Finish.
d. When you click on Data Explorer, your new connection should be visible.
29 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0162.png)
e. With the Data Explorer still opened, right click on Data Sets, and select New Data Set.
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0171.png)
f. For the data source location select Mysql Local (The data source you just created above).
h. For the query text, use “select * from admincost”. This will select all the contents of the table
admincost.
i. Click on finish.
30 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image018.jpg)
j. On your dataset, click on preview results, this will output the contents of the table admincost.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0191.jpg)
k. Click on Pallete and under report items, select grid. The grid allows you to organize the items in
your reports like images, charts, text etc.
(hĴps://spagolabs.files.wordpress.com
/2013/04/image020.png)
31 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04
/image0211.png)
(hĴps://spagolabs.files.wordpress.com
/2013/04/image022.png)
n. Click on embedded image then select the shemma.jpg image from the BIRT folder on the CD that
came with this book.
32 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image023.jpg)
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0241.png)
33 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com
/2013/04/image0251.png)
r. Once you are done, your report should look like the one shown below.
(hĴps://spagolabs.files.wordpress.com/2013/04/image026.jpg)
5. To include data from the data set we create above on the report, click on the Data Explorer tab.
Expand datasets and drag AdminCost on an empty area of your report.
(hĴps://spagolabs.files.wordpress.com/2013/04/image027.png)
6. Using the property editor, change the heading for id, item and cost.
a. Before
34 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image028.jpg)
b. After.
(hĴps://spagolabs.files.wordpress.com/2013/04/image029.jpg)
(hĴps://spagolabs.files.wordpress.com/2013/04/image030.png)
d. And there you have it, your very first BIRT report!
35 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image031.jpg)
7. Next we need to publish our report to the SpagoBI server. Proceed as follows.
a. In the data explorer, right click on Report Parameters then click on New Parameter. For the name
enter driver.
(hĴps://spagolabs.files.wordpress.com/2013/04
/image0321.png)
36 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com
/2013/04/image033.png)
c. Right click on the data source “Mysql Local”, click on edit and select Property Binding. AĴach the
parameters as shown below.
(hĴps://spagolabs.files.wordpress.com/2013/04/image034.jpg)
37 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image035.jpg)
(hĴps://spagolabs.files.wordpress.com/2013/04/image036.jpg)
e. Repeat the procedure for JDBC Driver URL, User Name and Password.
f. If you have not been Saving your work, this is a good time to do so!
g. Right Click on your Business Intelligence project and click on properties. Unser Resource, check
the location where your report is stored.
(hĴps://spagolabs.files.wordpress.com/2013/04/image037.jpg)
h. Take note of this location as we will use it when creating documents in Spago BI.
38 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image038.png)
(hĴps://spagolabs.files.wordpress.com/2013/04/image039.png)
12. Under Show document templates , select the folder you want your document to be stored.
13. Click on browse and navigate to where your AdministrativeCosts.rptdesign report file is stored.
15. Click on Administrative Tasks under the folder you saved your report. You should have the
report displayed on the SpagoBI server.
39 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image040.jpg)
Every car comes with a dash board which has several gauges that alerts the driver when an
important event have occurred. It might be that the car is running low on fuel or the engine oil is
geĴing low. It might be also that the baĴery is nor charging or you are driving with handbrake on!
An automobile dashboard need to be easy to understand and should not take time to read,
remember you are driving. A good dashboard should be easy to understand and should portray
relevant information. The business community copied this dashboard idea from the automobile
industry. Business dashboards show at a glance the state of the business at any given time. As an
example, a chart might show a comparison between sales between current quarter and the last
quarter. If all sales for previous quarters are greater than current quarter, then something is
definitely wrong.
Since a dashboard should be easy to read, normally only summaries are shown in dashboards.
Dashboards also show trends and comparisons.
We will create our first dashboard to compare sales between current year against sales for previous
year. The dashboard will be built using the highcharts library. First, we will write the Sql that will
help us get the sales comparisons between current year and previous year for the Nairobi store.
40 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
image0011
image0031
You can find the query under the dashboard folder in the CD that came with this book. It is called
dash1.txt. In case you are reading this at spagolabs blog, then you can get the mysql dump and other
files needed for this tutorial by writing the author at the email xogutu at gmail dot com for a small
fee.
Now that we have the query, we will create the xml template that will be used by highcharts. We
have included the xml below, it can be found under the dashboard folder in the CD that came with
this book. The xml file is called sales_comparison.xml.
<Y_AXIS_LIST>
<LABELS>
</LABELS>
</TITLE>
</Y_AXIS>
<LABELS>
</LABELS>
41 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
</TITLE>
</Y_AXIS>
</Y_AXIS_LIST>
<LEGEND layout=’vertical’
align=’left’
verticalAlign=’top’
x=’120′
y=’40’
floating=’true’
borderWidth=’1′
backgroundColor=’#FFFFFF’
shadow=’true’/>
<SERIES_LIST allowPointSelect=’true’>
</SERIES>
</SERIES_LIST>
</HIGHCHART>
Now login to SpagoBI as the biadmin user and follow these steps to create the dash board.
6. On Description, write “Sales comparison for Nairobi store between between current year and
previous year.”
42 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image004.png)
10. Under data source select “Sapgo BI Mysql Training”. Remember we had created this datasource
previously.
11. Under Query, Paste the query in the file dash.txt on the folder dashboard.
43 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0051.png)
13. Click on preview buĴon. You should have the output shown below.
(hĴps://spagolabs.files.wordpress.com/2013/04/image006.jpg)
44 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0071.png)
17. Click on browse and select the sales_comparison.xml file we created previously. The file can be
found on the CD that came with this book under dashboard folder.
18. Under documents template, select “Dash Boards” and click Save.
(hĴps://spagolabs.files.wordpress.com/2013/04
/image008.png)
45 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
20. Navigate to “Dash Boards” folder. Click on “Sales Comparison” document to run it.
(hĴps://spagolabs.files.wordpress.com/2013/04/image009.jpg)
(hĴps://spagolabs.files.wordpress.com/2013/04/image0101.jpg)
A. Chart Size.
The first element must be HIGHCHART. You can also specify the size of the chart in this element.
The TITLEand SUBTITLE elements are the title and subtitle of the charts.
46 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image012.png)
The element <X_AXIS alias=’current_month’ /> is the label of the X axis. In Spago Bi, this can come
from a column in your data set query.
(hĴps://spagolabs.files.wordpress.com/2013/04/image013.png)
In our chart, the labels come from the database column current_month from the dataset
SalesComparisonNairobi we created previously.
47 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0141.png)
The contents of current_ month column in the data set SalesComparisonNairobi through the xml
element <X_AXIS alias=’current_month’ /> is used to label the x axis with January up to December on
our chart.
D.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0161.png)
Y_AXIS_LIST Element.
48 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
The <Y_AXIS_LIST> element defines the items that appear on the Y axis. Normally they come from
database tables or views through the SpagoBi data set. For example, in the block of xml code below:
1. Alias element.
alias=’sales_previous_year’ – This defines which column in the dataset query the data comes from.
opposite=’true’ – When opposite is true, the label will appear on the right. When false it appears on
the left.
(hĴps://spagolabs.files.wordpress.com/2013/04/image017.png)
49 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image0181.png)
(hĴps://spagolabs.files.wordpress.com/2013/04/image019.jpg)
This element is used to set the labels of the items on the Y axis.
E. The LEGEND element determines the position, color and other properties of the legend.
50 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com
/2013/04/image020.jpg)
(hĴps://spagolabs.files.wordpress.com/2013/04/image021.jpg)
F.
(hĴps://spagolabs.files.wordpress.com/2013/04/image0231.png)
The SERIES_LIST element is the main contents of the chart. It can be line or column.
51 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
Since our chart has two lines, it therefore will have two series. The contents of the series come from a
table column through the Spago BI dataset. For example, the doĴet series (Sales for 2011) comes from
the column sales_current_year and the element dashStyle=’shortdot’ makes it doĴed. The element
type=’spline’ means a line chart, if we change it to type=’column’ , we will end up with a bar graph
as shown:
(hĴps://spagolabs.files.wordpress.com/2013/04/image024.jpg)
We would like to demonstrate this in Spago BI using simple data with one dimension and several
measures.
Shemma Global is a Business intelligence company that specializes in data mining and analysis. They
52 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
would like to view the memory usage of one of their servers by event time.
(hĴps://spagolabs.files.wordpress.com/2013/04/image001.jpg)
From the diagram olap 1 above, we are only interested in two columns, the event_date and
used_memory. The event_date is our dimension (how we would like to view the data) and the
used_memory is the data we would like to view (measure).
This kind of table is called a fact table. Normally dimension data like date, sales region e.tc are not
stored in a fact table but in a dimension table. A foreign key is then included in the fact table to link
the two .
Consider a telecommunication company as an example. We would make the fact table the central
table in our schema surrounded by dimension tables. Below is an example.
53 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image003.png)
Olap 2: Star Schema
In the above example, it is easy to answer questions like how many mobile phone subscribers were
activated in the last quarter or how many subscribers are post paid or prepaid. The above schema is
called a star schema. We would build a single fact table (Table 1) and link it to the dimension tables
using foreign keys.
For the purpose of this demonstration, we will keep the measure and dimension in a single fact table.
(hĴps://spagolabs.files.wordpress.com/2013/04/image005.png)
Note: Email the author at xogutu at gmail dot com for the sample
54 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
mysql database and other files used in this course for a small fee.
OLAP Cube.
An OLAP cube is a collection of measures (facts) and dimensions. In the telecommunication example
above, we can create a cube which can answer questions like how many subscribers were activated
on a certain year, certain quarter or certain month, or how much airtime was consumed by customers
from Nairobi region or how many subscribers are in pre-paid.
To create a cube in Spago BI, we will be using the SpagoBI JPivotEngine which comes embedded
with your Spago BI server. The cube will be created using xml schema files. This will be a simple
cube based on data from the diagram Olap 1 which shows the average amount of used memory by
day. The average used memory here is the measure or fact while the day is the dimension. So our
cube only has one dimension, the average amount of memory used on any given day. The resulting
xml schema looks like the one below:
(hĴps://spagolabs.files.wordpress.com/2013/04/image007.png)
Once you have created the schema, you need to tell SpagoBi server where the schema file exists.
Navigate to the root directory of your SpagoBI installation, in my case C:BIAll-In-One-SpagoBI-3.0-
apache-tomcat-6.0.18-06212011. We will call this the $SPAGO_ROOT directory. Inside
$SPAGO_ROOT, navigate to resourcesOlap folder. Save your Mondrian schema here. Give it a name
like AverageMemoryUsage.xml. Your folder will now appear as shown below.
55 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image008.jpg)
Next, you have to add to the engine-config.xml file the schema you just created. Navigate to
$SPAGO_ROOTapache-tomcat-6.0.18webappsSpagoBIJPivotEngineWEB-INFclasses folder. Inside there,
you will find the file engine-config.xml. Open it using your favorite text editor and add the following
lines.
The line should be added between the <SCHEMAS>…. </SCHEMAS> tags. You have to restart your
SpagoBI server for the changes to take effect. Once the server have been restarted, login to the url
hĴp://servername:8080/SpagoBI (hĴp://servername:8080/SpagoBI) and login using the username
biadmin and password biadmin.
(hĴps://spagolabs.files.wordpress.com/2013/04/image010.jpg)
56 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image012.jpg)
On the extreme right, click on insert buĴon to create a new data source.
(hĴps://spagolabs.files.wordpress.com/2013/04/image013.jpg)
Once done, save the Data Source. We will be using this data source for the remainder of the book.
Now we will create a folder where all our OLAP documents will be stored. Click on Analytical
Model -> Functionalities Management. Click on Functionalities then Insert.
57 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com
/2013/04/image014.png)
(hĴps://spagolabs.files.wordpress.com/2013/04/image015.jpg)
Finally we will create the OLAP document itself. Click on Analytical Model -> Documents
Development. Click on Insert buĴon.
58 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image016.png)
Under Show document templates click on OLAP Documents. Click on Save. Click on Template
build.
(hĴps://spagolabs.files.wordpress.com/2013/04/image017.jpg)
59 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image018.png)
Now let us drill down and see the average memory usage for any day of the week. Click on the +
next to All Types.
(hĴps://spagolabs.files.wordpress.com/2013/04
/image019.png)
And there you have it, your very first OLAP document. You can see that the average memory usage
for Saturday was 14,109.
60 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image021.png)
Store Sales example.Problem definition: Shemma Global has offices in Nairobi, Kisumu, Mombasa
and Kitale. The sales department would like to view the total sales for any store by year, quarter,
month and day. Our measure is sales and we have a time dimension here with multiple hierarchies:
year, quarter, month and day. Create a JPivot OLAP cube with SpagoBI to achive this.
1.
(hĴps://spagolabs.files.wordpress.com/2013/04/image023.png)
3. Next, you have to add to the engine-config.xml file the schema you just created. Navigate to
$SPAGO_ROOTapache-tomcat-6.0.18webappsSpagoBIJPivotEngineWEB-INFclasses folder. Inside there,
you will find the file engine-config.xml. Open it using your favorite text editor and add the following
lines.
61 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04/image024.png)
62 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04
/image025.png)
13. Now let us compare Sales for Quarter 4 for Nairobi in 2011 against Sales for Quarter 4 for 2010.
(hĴps://spagolabs.files.wordpress.com/2013/04
/image027.jpg)
63 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
14. Now let us compare sales between quarter 3 and 4 of 2011 for all stores.
(hĴps://spagolabs.files.wordpress.com/2013/04/image028.png)
(hĴps://spagolabs.files.wordpress.com/2013/04/image029.png)
17. You will now be able to compare sales for any duration with any other duration for all the stores.
64 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
image032
image030
We will now add total sales to our example above. Modify the Mondrian schema above to include
the following lines.
(hĴps://spagolabs.files.wordpress.com/2013/04/image033.jpg)
We have the total sales now, how can we move it to the last column?
1. hĴp://jpivot.sourceforge.net/ (hĴp://jpivot.sourceforge.net/)
2. hĴp://wiki.spagobi.org/xwiki/bin/view/spagobi_server/JPivot (hĴp://wiki.spagobi.org/xwiki
/bin/view/spagobi_server/JPivot)
3. hĴp://mondrian.pentaho.com/documentation/schema.php (hĴp://mondrian.pentaho.com
/documentation/schema.php)
65 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
1. SpagoBI Server – This is the actual business intelligence platform that offers all the core and
analytical functionalities. It is also where we will be hosting all reports created using BIRT. Click
on All-In-One-SpagoBI-3.3-01242012.zip to download the SpagoBI Server as illustrated below.
(hĴps://spagolabs.files.wordpress.com/2013/04
/selectfile.jpg)
1. SpagoBI Studio – We will need the SpagoBI studio to create BIRT reports. BIRT is an eclipse
based business intelligence and reporting tool and the acronyms stand for Business Intelligence
and Reporting Tools. Download SpagoBI Studio by clicking on
SpagoBIStudio_3.3_win_20120120.zip as illustrated below.
(hĴps://spagolabs.files.wordpress.com/2013/04
/bistudio.jpg)
In addition to the two pieces of software above, you will need to install java development kit and
ensure that the java bin directory is in your computers PATH variable.
Configuring SpagoBI.
I downloaded and kept my all my software on the folder C:\BI so the full path to my SpagoBI server
is C:\BI\All-In-One-SpagoBI-3.0-apache-tomcat-6.0.18-06212011. As you can see from the path
above, I am using version 3.0 but you should download the latest version if it is available. Navigate
to C:\BI\All-In-One-SpagoBI-3.0-apache-tomcat-6.0.18-06212011\apache-tomcat-6.0.18\bin and
double click on the file startup.bat to start SpagoBI server. This takes relatively longer to start on
windows as opposed to linux.
66 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04
/startup.jpg)
From the startup output, we can see that SpagoBI uses the tomcat server as a default and therefore
you can easily change the IP address of the server and the port from the tomcat configuration file in
the location C:\BI\All-In-One-SpagoBI-3.0-apache-tomcat-6.0.18-06212011\apache-tomcat-6.0.18
\conf\server.xml
Note: You might get the error “SEVERE: Catalina.start LifecycleException: Protocol handler
initialization failed: java.net.BindExcept ion: Address already in use: JVM_Bind<null>:8080” if the
port is already used by another server.
Note: By default, there are various other users e.g bitest, bimodel, bidev, biuser with password
being the same as the username but we will ignore these other users at this point.
Now that we have logged in into SpagoBI, we can test a few objects that come embedded with
SpagoBI before we start creating our own.
Steps:
(hĴps://spagolabs.files.wordpress.com/2013/04
/login.jpg)
2. Navigate to Root -> Examples -> Report_BIRT and click on Report with image.
(hĴps://spagolabs.files.wordpress.com/2013/04
67 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
/reportwithimage.jpg)
Below image shows how a BIRT report looks like. We will be creating BIRT reports in this book.
(hĴps://spagolabs.files.wordpress.com/2013/04
/birtreports.jpg)
1. Navigate to Root -> Examples -> OLAP_Jpivot_Mondrian and click on Simple OLAP.
(hĴps://spagolabs.files.wordpress.com/2013/04
/simpleolap.jpg)
Olap allows you to view data in various dimensions like in the example above, you can view
information drinks in so many ways by just collapsing the product and Region as shown below. We
will learn how to create our own OLAP objects using a step by step example in this book. We can see
that there were 55 units of Washington Diet Cola ordered in Mexico Central. This allows you to view
a very large amount of information easily by slicing and dicing!
(hĴps://spagolabs.files.wordpress.com/2013/04
/slicinganddicing.jpg)
4. Navigate to Root -> Examples -> Charts – Highcharts. The High charts engine is one of the best
chart engine available. The charts are very informative and beautiful to look at. Click on any chart to
see for yourself. We will be learning how to use this wonderful engine in this book.
68 of 69 07/09/2018, 06:20
SpagoBI Tutorials (Business Intelligence step by step) – OLAP, Datam... https://spagolabs.wordpress.com/
(hĴps://spagolabs.files.wordpress.com/2013/04
/highcharts.jpg)
Posted in SpagoBI, SpagoBI Lessons | Tagged apachetomcat, Business intelligence, Java, OLAP,
Servers, SpagoBI, Uploading and downloading | 2 Comments
69 of 69 07/09/2018, 06:20