Data Visualization Lab Manual
Data Visualization Lab Manual
MAHARAJA INSTITUTE OF
TECHNOLOGY THANDAVAPURA
NH 766, Nanjangud Taluk, Mysuru – 571302
DEPARTMENT OF ARTIFICIAL
INTELLIGENCE AND DATA SCIENCE
1. Introduction to Tableau
Purpose: Explain that Tableau is a powerful data visualization tool used for transforming raw data into
interactive, insightful visualizations, helping users understand and analyze data patterns and insights.
Applications: Used in various industries like finance, healthcare, and marketing for data-driven
decision-making.
Connecting Data:
o Step 1: Open Tableau and choose a data source (e.g., Excel, CSV, database).
o Step 2: Connect to your dataset, which will appear in the Data Pane.
3. Tableau Terminologies
Dashboards:
o Step 1: Select ‘Dashboard’ from the navigation menu.
o Step 2: Drag sheets onto the workspace to combine multiple visualizations.
o Step 3: Use layout adjustments to make the dashboard clear and readable.
Program 02:
Inner Join:
o Returns only rows that have matching values in both tables.
o Example: If you have a “Sales” table and a “Customer” table, an inner join will display only the
customers who have made purchases.
Left Join:
o Returns all rows from the left table and matched rows from the right table. Unmatched rows
from the right table will show as null.
o Example: Joining “Customers” with “Sales” using a left join will show all customers, including
those who haven’t made purchases (those rows will display nulls for “Sales” data).
Right Join:
o Returns all rows from the right table and matched rows from the left table. Unmatched rows
from the left table will show as null.
o Example: Joining “Sales” with “Products” using a right join will show all products, even those
without sales (those rows will display nulls for “Sales” data).
Full Outer Join:
o Returns all rows when there’s a match in either the left or right table. Rows without matches in
both tables will show nulls where data is missing.
o Example: Joining “Employees” and “Departments” using a full outer join shows all employees
and departments, even if some employees are not assigned to departments or some departments
have no employees.
Step 1: After connecting to your data source, select the first table you want to work with in the Data
Pane.
Step 2: Drag a second table to the workspace. Tableau will automatically prompt you to define the join
type.
Step 3: Choose the appropriate join type and set the matching field(s) (called keys), which should be
common in both tables.
Step 4: You can add more tables and joins if required, but keep in mind that each additional join can
impact performance.
Minimize Complex Joins: Complex joins can affect performance, so try to use only necessary fields
and consider using data extracts for efficiency.
Use Filters Post-Join: Apply filters to narrow down the dataset after the join is created, keeping only
relevant data for faster processing.
Review Join Results: Check for nulls and ensure data integrity after joining tables, especially with outer
joins.
Program 03:
Creating a View formatting charts, adding filters, creating calculated fields and defining
parameters.
2. Formatting Charts
3. Adding Filters
Purpose of Filters:
o Filters limit the data displayed in a view to focus on specific aspects, making visualizations more
relevant.
Steps to Add Filters:
o Step 1: Drag a field (e.g., Year or Category) to the Filters shelf.
o Step 2: Choose filter options. For example, select individual years or categories to filter.
o Step 3: Right-click the filter on the Filters shelf and choose “Show Filter” to add a dynamic filter
control to the view, allowing users to interactively change filter settings.
5. Defining Parameters
Purpose of Parameters:
o Parameters are dynamic values that can be used as filters, for calculated fields, or to allow users
to customize the view.
Steps to Define a Parameter:
o Step 1: In the Data Pane, click the drop-down menu next to Parameters and select “Create
Parameter.”
o Step 2: Name the parameter, select its data type (e.g., integer, string), and define allowable
values.
o Step 3: Use the parameter in calculations or filters. For example, you might use a parameter to
select a specific category or change a threshold.
o Step 4: Right-click the parameter and select “Show Parameter” to add a control to the view,
allowing users to adjust the parameter value interactively.
Program 04
Components of a Dashboard:
o Sheets: These are individual visualizations (charts, graphs, or maps) created on separate sheets
and combined within a dashboard.
o Filters: Allow viewers to adjust the dashboard data dynamically.
o Parameters: Add interactivity, letting users change values or control specific fields.
o Text and Titles: Provides context, explanations, or calls to action.
o Images and Web Objects: Logos, explanatory visuals, or external links can enhance
engagement.
o Tooltips: Offer additional details when hovering over a specific data point.
Program05
Introducing Power BI -Components and the flow of work. Power BI Desktop Interface-
The Report has five main areas.
Introduction to Power BI
o Power BI is a powerful business analytics tool by Microsoft that allows users to visualize data,
gain insights, and make data-driven decisions. It enables users to connect to various data sources,
transform data, create interactive reports, and share them across the organization.
Components of Power BI:
o Power BI Desktop: The main application used to connect, transform, and visualize data. Reports
and dashboards are created here.
o Power BI Service (Cloud): An online platform for sharing, collaborating, and publishing reports
created in Power BI Desktop.
o Power BI Mobile: Mobile applications for viewing and interacting with Power BI reports and
dashboards on Android, iOS, and Windows devices.
o Power BI Report Builder: A tool for creating paginated reports that are ideal for printing and
detailed reporting.
o Power BI Gateway: A bridge between on-premises data sources and the Power BI service,
enabling real-time or scheduled data refreshes for reports.
1. Connect to Data:
o Use Power BI Desktop to connect to various data sources (e.g., Excel, databases, cloud services).
2. Data Transformation (Data Preparation):
o Use the Power Query Editor within Power BI Desktop to clean, transform, and shape the data.
This step includes actions like removing duplicates, filtering data, creating calculated columns,
and adjusting formats.
3. Data Modeling:
o Define relationships between different tables and create calculated measures and columns as
needed. Data modeling allows for logical structuring and prepares data for analysis.
4. Visualization:
o Build visualizations on report pages using various chart types (bar, line, pie charts, maps, etc.),
and combine them into a cohesive report.
5. Publishing:
o Once the report is ready, publish it from Power BI Desktop to the Power BI Service, where it can
be shared with others or embedded in applications.
6. Sharing and Collaboration:
o Users can share reports and dashboards with others through the Power BI Service, enabling
collaboration, feedback, and interaction.
In Power BI Desktop, the Report view is the primary workspace where visualizations are created. This area
consists of five main sections:
1. Canvas:
o This is the central workspace where you build and arrange visualizations for each report page.
The canvas allows you to add multiple visualizations, organize them, and create interactive, data-
driven reports.
2. Visualizations Pane:
o This pane contains different chart types and visualization options, such as bar charts, line charts,
maps, and tables.
o Use this area to select and customize visualizations, add filters, and adjust properties like axis
labels, colors, and interactions.
3. Fields Pane:
o Displays all the data fields and tables connected to the report. You can drag fields from this pane
to the canvas to create visualizations, use them in filters, or add them to visual elements on the
canvas.
o The Fields Pane is also where you’ll find calculated columns and measures created during data
modeling.
4. Filters Pane:
o Allows you to add and manage filters for the entire report, individual pages, or specific
visualizations.
o Filters can be applied globally (across all pages) or specifically to control what data is displayed
in a particular visualization, enabling users to refine data views dynamically.
5. Pages Tab (Report Pages):
o Located at the bottom, this section lets you create multiple report pages within a single Power BI
report. Each page can have its own layout and visualizations, providing flexibility to structure
reports by topic or analysis focus.
Program06
Querying Data from CSV-Query Editor, Connecting the data from the Excel Source,
Clean, Transform the data
The Query Editor allows you to apply various data cleaning and transformation operations before
loading it into Power BI. Here, you can shape data as needed.
Once in the Query Editor, you can use various tools to prepare your data:
4. Applying Transformations
Replace Values:
o Right-click on a column and select Replace Values to replace specific data entries.
Split Columns:
o If a column has multiple values separated by a delimiter, you can split it by Delimiter (e.g.,
comma, space) or by a specific character count.
Combine Queries:
o Use Merge Queries or Append Queries to combine data from multiple sources (like additional
CSV files or tables) into a single dataset.
Add Calculated Columns:
o You can create custom columns based on calculations or expressions by selecting Add Column
> Custom Column.
Step 1: Once you’ve made all necessary transformations, click on Close & Apply. Power BI will load
the transformed data into the Data Model.
Step 2: You can now use this clean, transformed dataset to create visuals, build reports, and perform
further analysis in Power BI Desktop.
Program07
Creating Reports & Visualizations Different types of charts, Formatting charts with Title,
Colors.
Power BI offers various chart types to help display data effectively. Here are some commonly used ones:
Bar/Column Chart:
o Useful for comparing categories or showing changes over time when categories are organized
along the x-axis.
Line Chart:
o Ideal for showing trends or patterns over time (e.g., monthly sales trends).
Pie/Donut Chart:
o Displays proportions of a whole, great for visualizing percentage contributions.
Map Visualizations:
o Shows data distribution geographically, excellent for location-based data like sales by country or
state.
Scatter Plot:
o Useful for showing relationships or correlations between two numerical values.
Tree Map:
o Represents hierarchical data, where each category is displayed as a rectangle proportionate to its
value.
Table/Matrix:
o A table presents data in rows and columns, while a matrix adds more layers to display data
hierarchically, similar to pivot tables.
2. Creating a Chart
Step 1: Drag the desired fields from the Fields pane onto the report canvas.
Step 2: Power BI will auto-generate a visualization based on the data type. You can change the
visualization type by selecting it from the Visualizations pane.
Step 3: Once the chart appears on the canvas, you can further refine it by dragging additional fields to
areas like Axis, Legend, Values, etc., in the Visualizations pane.
3. Formatting Charts
To make charts more readable and visually appealing, Power BI offers various formatting options:
Chart Title:
o Go to the Format pane and enable the Title option.
o Customize the title text, font, color, and alignment to match the report style.
Axis Labels:
o Enable Axis Titles in the Format pane to label the x-axis and y-axis clearly.
o Adjust font size, color, and title names to improve readability.
Data Colors:
o Use the Data Colors section to change the color of bars, lines, or other chart elements.
o Customize based on the data categories or use brand colors to maintain consistency.
Legends:
o Enable and position the legend to help viewers understand the chart’s colors or categories.
Data Labels:
o Enable Data Labels to show specific values on each chart element. Customize label size, font,
and position for better readability.
Conditional Formatting:
o For certain visualizations (like tables and bar charts), you can apply conditional formatting to
color-code values based on rules or scales (e.g., green for high values, red for low).
Background and Borders:
o Set a background color for the chart or add borders to improve contrast with the report’s overall
layout.
Tooltips:
o Customize tooltips to display more information when hovering over chart elements, adding
valuable context without cluttering the chart.
After adding and formatting charts, you can arrange them on the canvas to create a cohesive report layout:
Organize charts based on logical flow, ensuring that key insights are front and center.
Add slicers, filters, or additional elements like shapes or text boxes to guide the viewer through the
report.
Program08
Dashboards-Filters in Power BI, Formatting dashboards.
Filters in Power BI allow users to narrow down the data displayed on the dashboard based on specific criteria.
Filters can be applied at different levels:
Visual-Level Filters:
o Apply filters directly to specific visualizations. This means that only the filtered data will display
on that particular chart or table.
o To add a visual-level filter, select the visualization, go to the Filters pane, and drag a field into
the Filters on this visual area.
Page-Level Filters:
o Apply filters to an entire report page so that all visuals on that page respond to the filter criteria.
o Use the Filters pane and place the desired field in the Filters on this page section.
Report-Level Filters:
o Set filters across all pages in a report, affecting every visual on every page.
o In the Filters pane, drag the field into the Filters on all pages section to apply it globally.
Slicers:
o Slicers are visual filters that provide an interactive way for users to filter data by selecting
options directly on the dashboard.
o You can add a slicer by selecting it from the Visualizations pane and choosing the field you want
to filter by (e.g., Date, Region, Product Category).
Drillthrough Filters:
o These filters allow users to right-click a data point and drill through to another page with more
details. This can be especially useful for displaying detailed information on a separate page
based on the selected data.
Review the dashboard to ensure it’s easy to interpret and visually appealing.
Test all filters, slicers, and drillthroughs to verify they’re functioning correctly and providing the desired
interactivity.
Share the dashboard and solicit feedback, as well-placed filters and formatting can significantly enhance
the dashboard’s usability and impact
Program 09
ii) Create a line chart to show the revenue based on the month of the year.
iii) Create a bin of size 10 for the age measure to create a new dimension to show the
revenue.
iv) Create a donut chart view to show the percentage of revenue per region by creating
zero access in the calculated field.
v) Create a butterfly chart by reversing the bar chart to compare fernale & male
revenue based on product category
vi) Create a calculated field to show the average revenue per state & display profitable
& non-profitable state.
Steps:
o Data: Use the State and Revenue fields.
o Build:
Map State to the geographic field.
Set Revenue as the measure and use it in the Color field to fill the states by revenue.
o Labels: Display revenue figures for each state.
Steps:
o X-Axis: Month (using the date field, aggregated by month).
o Y-Axis: Revenue.
o Build: Select Line Chart type and plot Revenue over Month.
Steps:
Steps:
o Data: Use Region and Revenue.
o Build:
Create a pie chart using Region and SUM(Revenue).
Adjust it into a donut by adding an empty center.
Calculate zero-axis values to position the labels.
Steps:
o Data: Use Gender, Product Category, and Revenue.
o Build:
Create a bar chart with Product Category on the Y-axis and split bars for Revenue by Gender.
Reverse one axis for a butterfly effect, showing Female on one side and Male on the other.
Steps:
o Calculated Field: Create a field to calculate Average Revenue per State.
o Logic: Add profitability logic (e.g., profitable if above a revenue threshold).
o Build: Display profitable and non-profitable states by color coding.
Steps:
o Arrange the choropleth map, line chart, and butterfly chart on the dashboard.
o Add interactive filters for states, age bins, and regions.
o Include profit/non-profit insights for easy reference.
Program 10
1) Visualize the countries data given in the dataset with respect to latitude and longitude
along with country name using symbol maps.
iv) Visualize the countries Bhutan & Costa Rica competing in terms of GDP.
) Create a scatter plot or circle views of GDP of Mexico, Algeria, Fiji, Estonia from 2004
to 2006.
Fields:
Fields:
Year: Filter to include years from 2006 to 2020 (this will be on the X-axis).
GDP: The GDP value for Belgium for each year (this will be on the Y-axis).
Fields:
Country Name: The names of the countries (India, Nepal, Romania, South Asia, Singapore).
GDP: The GDP value for each of these countries specifically for the year 2010.
Fields:
Year: Filter for the years in which you have GDP data for Bhutan and Costa Rica (this will be on the X-
axis).
GDP: The GDP value for Bhutan and Costa Rica (this will be on the Y-axis).
Country Name: Used for coloring and labeling the lines or bars (e.g., Bhutan in one color and Costa
Rica in another).
Fields:
Year: Years 2004, 2005, and 2006 (this will be on the X-axis).
GDP: The GDP values for each of the specified countries (this will be on the Y-axis).
Country Name: Used for differentiating data points by country (different colors or shapes for each
country).
Fields:
Include all the fields used in the previous visualizations to ensure interaction.
Filters: Add interactive filters for:
o Year: Allow users to select specific years.
o Country Name: Allow users to filter based on selected countries.
Program 11
Analysis of HR Dataset:
1)Create KPI to show employee count, attrition count, attrition rate, attrition count,
active employees, and average age.
ii) Create a Lollipop Chart to show the attrition rate based on gender category.
iii) Create a pie chart to show the attrition percentage based on Department Category-
Drag department into colours and change automatic to pie. Entire view, Drag attrition
count to angle. Label attrition count, change to percent, add total also, edit label.
iv) Create a bar chart to display the number of employees by Age group, v) Create a
highlight table to show the Job Satisfaction Rating for each job role based on employee
count
vi) Create a horizontal bar chart to show the attrition count for each Education field
Education field wise attrition-drag education field to rows, sum attrition count to col,
vii) Create multiple donut chart to show the Attrition Rate by Gender for different Age
group
KPIs to Create:
Employee Count: Total number of employees.
Attrition Count: Total number of employees who have left the company.
Attrition Rate: (Attrition Count / Employee Count) * 100.
Active Employees: Total number of employees currently active (Employee Count - Attrition Count).
Average Age: Average age of employees.
Fields:
Fields:
Fields:
Fields:
Age Group: Create age bins (e.g., 20-29, 30-39) for grouping.
Employee Count: Count of employees in each age group (Y-axis).
Fields:
Fields:
Education Field: Drag to rows.
Attrition Count: Sum of attrition count (Y-axis).
7) Multiple Donut Charts: Attrition Rate by Gender for Different Age Groups
Fields:
Program 12
Dataset Fields
Before proceeding with the visualizations, ensure your dataset includes the following fields:
Visualizations
Steps:
Data Preparation:
o Create a calculated field to count the number of movies and TV shows.
Build the Donut Chart:
o Outer Circle: Create a pie chart using the calculated field for counts of Movies and TV Shows.
o Inner Circle: Create a smaller pie chart with a blank value to form the donut shape.
Fields:
o Category: Type (Movies, TV Shows).
o Value: Count of Titles.
Steps:
Data Preparation:
o Use a date field or create a calculated field for release year.
Fields:
o X-Axis: Release Year.
o Y-Axis: Count of Titles.
o Color/Filter: Type.
Steps:
Data Preparation:
o Count the number of titles for each genre.
Fields:
o Y-Axis: Genre.
o X-Axis: Count of Titles.
4) Map: Total Shows by Country
Steps:
Fields:
o Location: Country.
o Size/Color: Count of Titles.
Steps:
Components:
o Donut Chart.
o Area Chart.
o Horizontal Bar Chart.
o Map.
o Text Sheet.