How To Build Dashboard Using Excel
How To Build Dashboard Using Excel
This paper will illustrate how to build Dashboard (reports, charts) from Excel Spreadsheet. The data file is also provided so you can follow the steps.
http://www.infocaptor.com
1/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
How to build Dashboard (reports, charts) from Excel Spreadsheet.........................................................................3 This is the sample Excel Spreadsheet test_data.xls............................................................................................. 3 Launch InfoCaptor............................................................................................................................................... 4 Connect to the Excel file......................................................................................................................................5 Create your first Dashboard................................................................................................................................. 6 Add content to your new Dashboard................................................................................................................... 7 Syntax for Querying Excel Worksheets...........................................................................................................7 Your first Portlet (Qlet ).......................................................................................................................................7 Portlet Customizations......................................................................................................................................... 9 Create Summary Portlets................................................................................................................................... 10 By Region...................................................................................................................................................... 10 By Product Category......................................................................................................................................10 By Channel.....................................................................................................................................................11 Create Pie Chart (Glet).......................................................................................................................................12 Add Parameters..................................................................................................................................................18 Year Parameter...............................................................................................................................................18 Link the Parameters to Portlet............................................................................................................................22 By Region...................................................................................................................................................... 25 By Channel.....................................................................................................................................................25 By Product Category......................................................................................................................................25 Top Countries.................................................................................................................................................25 By Period....................................................................................................................................................... 25 Dynamic Refresh of Dashboard when changing Parameter.............................................................................. 26 The Dashboard So Far....................................................................................................................................... 29 Create Drills Drill from one portlet to another............................................................................................... 29 Important Information............................................................................................................................................34 Column Names...................................................................................................................................................34 Connection problems? ...................................................................................................................................... 34
2/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
3/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Launch InfoCaptor
4/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
If the path of the Excel file is c:\files\data.xls then use \\ , result c:\\files\\data.xls In this case the file to be used is d:\\test_data.xls. Select Excel File sun.jdbc.odbc.JdbcOdbcDriver from the Driver list.
5/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Click on the New Dashboard button (yellow highlight) Enter the desired dashboard name (green highlight) Click OK (blue highlight) It creates an empty dashboard as shown below
6/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
7/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Click on the New Qlet button or select Create Query Portlet from Menu bar In the property window as shown above, enter the Qlet Name Select the Connection Enter you query in the text editor Click on the Apply button
8/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Portlet Customizations
Once your portlet is visible, you can change the cosmetic features such as colors and fonts, increase/decrease column widths, change the location of the portlet and resize the portlet.
9/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
By Region
select country_region, sum(quantity_sold) as qty_sold, sum(amount_sold) as amt_sold from [detail_data$] group by country_region order by 3 desc
order by 3 desc tells to sort by the third column in descending order. You can also mention the sort this way order by sum(amount_sold) desc or order by sum(amount_sold) asc for ascending We will add few more portlets as shown below.
By Product Category
select prod_category, sum(quantity_sold) as qty_sold, sum(amount_sold) as amt_sold from [detail_data$] group by prod_category order by sum(amount_sold) desc
10/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
By Channel
select channel_class, sum(quantity_sold) as qty_sold, sum(amount_sold) as amt_sold from [detail_data$] group by channel_class order by sum(amount_sold) desc
11/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
But what is a dashboard without charts? Lets add some colors to it with charts.
select country_region, sum(quantity_sold) as qty_sold from [detail_data$] group by country_region order by 3 desc Click Apply
12/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
We dont need the order by clause for a pie chart. You can select pie , Pie 3d or Ring from the drop down. Here is the 3D pie version
13/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Similarly lets create other pie charts By Product Category Pie chart select prod_category, sum(quantity_sold) as qty_sold from [detail_data$] group by prod_category
By Channel Class select channel_class, sum(quantity_sold) as qty_sold from [detail_data$] group by channel_class
14/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
As you see the portlets are randomly placed and sized. We will take care of the placement and sizing later. Lets add few more stuff to the dashboard. Now we add a Bar chart Top Countries select country_name, sum(quantity_sold) as qty_sold from [detail_data$] group by country_name order by sum(quantity_sold) desc
15/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
We select the Chart Type = Bar, enter the query and hit Full Apply The bar chart is displayed but there are few ugly things. The labels on the X-Axis are overlapping, we need proper names for the X and Y axes and what if we just need to see the Top 5 Countries?
As you see, we changed the Max Rows=5 which limits the bar chart to top 5 countries. We changed the X Axis label = Country, Y Axis label = Quantity Sold and finally we set the x Axis label angle to 30 degrees Lets add another bar chart by Month By Period select calendar_month_name, sum(quantity_sold) as qty_sold from [detail_data$] group by calendar_month_name
16/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Now we align and re-size the portlets Click on Menu Edit Show Grid. Drag the borders of each portlet and resize them as you see fit
17/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Now that our dashboard is almost ready, we will add some parameters and make it more user friendly.
Add Parameters
Year Parameter
Click on the new parameter button or from the menu select Create Parameter
18/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Enter Year as the parameter name In the Display Column type distinct fiscal_year In the text editor type the worksheet name FROM [detail_data$] Click on Fully Apply
The above is the result list of values The list of value is showing a decimal value, this is because of the Excel formatting.
19/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Change the query to add a condition as below. We will use the TRIM function (if you list of values shows a null value then also add a where condition to remove null value e.g where fiscal_year <> null )
20/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
For this parameter we have enabled the All Values. We also added country_region in the (ID1) Internal Column1 property. This is needed in order for All Values to work. Now we need to wire all the portlets to the above two parameters.
21/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Just after [detail_data$], hit Enter or return key to create a new line below Type and fiscal_year = , then right click just after the = sign A list of all Parameters is made visible.
Select the Year (p33) parameter, a sub-menu will popup Select p33: Get Display >/*distinct TRIM(fiscal_year)*/ p33 is the internal Identifier for the Year parameter Once you select p33: Get Display >/*distinct TRIM(fiscal_year)*/, the query should be as shown below
select country_region, sum(quantity_sold) as qty_sold, sum(amount_sold) as amt_sold from [detail_data$] where fiscal_year = 'G_PARAM<p33:Display>' /*distincttrim(fiscal_year)*/ group by country_region order by 3 desc
22/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Since Year is a numeric value, we will remove the quotes around G_PARAM<p33:Display> and remove the string /*distinct TRIM(fiscal_year)*/. So the final query looks as shown below
select country_region, sum(quantity_sold) as qty_sold, sum(amount_sold) as amt_sold from [detail_data$] where fiscal_year = G_PARAM<p33:Display> group by country_region order by 3 desc
The code G_PARAM<p33:Display> is an instruction to pick the current value of the Year parameter identified by id = p33 and get the Display Value When you click on Full Apply, the SQL query is dynamically reconstructed at run time to use the parameter value. If you go to menu Run Display Log, click on Log Enabled button, refresh the chart and go back to the Display Log, you will see the modified query as it is submitted.
23/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
For the Region we include a LIKE operator. Since we have enabled All Values in the region parameter, the All Values internally passes a % character in the ID1 field, i.e if you select All Values in the region parameter then the G_PARAM<p34:ID1> will contain a value of %, in all other cases it will contain the actual country region. Here is the log display with All Values
We will apply the above conditions to all the portlets. The resultant queries are as below
24/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
By Region
select country_region, sum(quantity_sold) as qty_sold, sum(amount_sold) as amt_sold from [detail_data$] where fiscal_year = G_PARAM<p33:Display> and country_region like 'G_PARAM<p34:ID1>' group by country_region order by 3 desc
By Channel
select channel_class, sum(quantity_sold) as qty_sold from [detail_data$] where fiscal_year = G_PARAM<p33:Display> and country_region like 'G_PARAM<p34:ID1>' group by channel_class
By Product Category
select prod_category, sum(quantity_sold) as qty_sold, sum(amount_sold) as amt_sold from [detail_data$] where fiscal_year = G_PARAM<p33:Display> and country_region like 'G_PARAM<p34:ID1>' group by prod_category order by sum(amount_sold) desc
Top Countries
select country_name, sum(quantity_sold) as qty_sold from [detail_data$] where fiscal_year = G_PARAM<p33:Display> and country_region like 'G_PARAM<p34:ID1>' group by country_name order by sum(quantity_sold) desc
By Period
select calendar_month_name, sum(quantity_sold) as qty_sold from [detail_data$] where fiscal_year = G_PARAM<p33:Display> and country_region like 'G_PARAM<p34:ID1>' group by calendar_month_name
When you change any of the parameters, you need to click on the Refresh Dashboard action refreshes the full dashboard.
button. This
25/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Having to click on the Refresh button everytime you change the parameter is little tedious. So is there a way where the dashboard refreshes automatically whenever there is a change in parameter? Absolutely! Infact, you can control which portlet gets refreshed for any particular parameter change.
The internal ID for By Region portlet is = q32. Now we will add a trigger in the Year parameter to refresh By Region whenever the user changes or selects a year value
26/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
As shown above, edit the Year parameter (right click on Year title, select Edit) Set Run Dynamic Java Script = Y Click on the Dynamic Java Script Editor Type the following command //<REFRESH_LIST>q32</REFRESH_LIST> You can refresh more than one portlet by adding the portlet id separated by comma e.g. //<REFRESH_LIST>q32,q34,g35</REFRESH_LIST> Now if you need to refresh all the portlets then there is an easy shortcut Just type //<REFRESH_LIST>ALL</REFRESH_LIST> NOTE: ALL is in Caps Similarly, add the trigger command to the Region parameter
27/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
28/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
In the above code, we introduced a new element which is called as Portlet Filters. Each portlet filter is defined using the following syntax [param<Filter name, default filter value>]. The quotes at the beginning and end of the filter definition are needed if the column (in this case pldesc) is character. If the filter is against a numeric column then you dont need the quotes.
29/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Once you click Apply, it prompts you to enter the Filter value
We can type any value in the Region Name or just accept the default Asia value. Click on Apply. The portlet is refreshed and the results are as shown below.
30/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Now focus on the By Region Qlet Right click on the first column i.e. on any cell in the Country Region column
Switch to the Drill Settings Tab as shown here Click on the Add button. Enter Drill Name, Select Drill Into as By Region and Country
31/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Once you select the Drill Into value as By Region and Country, the Parameter region will show the available parameters. Click on the values region and a drop down will appear. This is the list of available columns from the By Region Qlet which is the parent Qlet. Select the Country_region value Click on Done and Close Click on Close on the Drill Settings tab Refresh the By Regions Qlet and you will see the Drill indicator on the Country Region column
32/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Select Get Details by Country The child Qlet is refreshed and the drill value is displayed
33/34
How to build Dashboard using Excel data with InfoCaptor Dashboard Designer
Important Information
Column Names
The first row of the Excel file is assumed to be the Column names. Its good idea to not have spaces in your column names. For e.g If possible convert a column name like Account Balance to Account_Balance. This way you can directly refer the column name in your SQL query. Alternatively, If you have blank spaces in between words in your Column name then put them in double quotes Account Balance , For e.g. Select sum(Account Balance) from [sheet1$]
Connection problems?
If your excel file C:\\test_data.xls is open in Excel, you cannot connect using InfoCaptor. Similarly if your Excel file is connected through InfoCaptor then you may not open it in Excel, you may lose your connection.
34/34