Power BI Learning Material
This document provides an introduction to Microsoft Power BI, a powerful
business intelligence and data visualization tool. It covers the basics of Power BI,
including installation, connecting to data, creating visualizations, building
dashboards, and performing basic DAX calculations, with practical examples.
Table of Contents
1. What is Power BI?
2. Installing Power BI
3. Connecting to Data
4. Creating Visualizations
5. Building Dashboards
6. Basic DAX Calculations
7. Common Power BI Features
8. Practice Exercises
What is Power BI?
Power BI is a Microsoft business analytics platform that enables users to visualize
and analyze data through interactive reports and dashboards. It integrates with
various data sources and supports advanced analytics using DAX (Data Analysis
Expressions).
Installing Power BI
To get started with Power BI:
1. Download Power BI Desktop:
o Visit Microsoft’s Power BI website and download Power BI Desktop
(free).
2. Install: Follow the installation instructions for Windows (Power BI Desktop is
Windows-only).
3. Verify Installation: Open Power BI Desktop and ensure you can create a
new report.
4. Optional: Sign up for a free Power BI account to publish and share reports
online via the Power BI Service.
Connecting to Data
Power BI supports various data sources, including Excel, CSV, SQL Server, and
cloud services like Azure or SharePoint.
Example: Connecting to a CSV File
1. Open Power BI Desktop and click Get Data > Text/CSV.
2. Select a CSV file (e.g., sales_data.csv with
columns: Order_ID, Product, Category, Sales, Region, Order_Date).
3. Click Load or Transform Data to open Power Query Editor for data cleaning
(e.g., removing nulls or formatting dates).
4. Load the data into Power BI for analysis.
Sample sales_data.csv structure:
Order_ID,Product,Category,Sales,Region,Order_Date
1,Laptop,Electronics,1200,East,2023-01-15
2,Chair,Furniture,150,West,2023-02-10
3,Phone,Electronics,800,North,2023-03-05
Creating Visualizations
Power BI uses a drag-and-drop interface to create visualizations in
the Report view.
Example: Bar Chart of Sales by Category
1. Go to the Report view.
2. Select a Clustered Bar Chart from the Visualizations pane.
3. Drag Category to the Axis field and Sales to the Values field.
4. Customize:
o Add data labels: Click the visual, go to Format Visual, and
enable Data Labels.
o Change colors: Use the Format Visual pane to adjust bar colors.
Example: Line Chart of Sales Over Time
1. Select a Line Chart from the Visualizations pane.
2. Drag Order_Date (set to Month or Year) to the Axis field and Sales to
the Values field.
3. Add a filter:
o Drag Region to the Filters pane and select a specific region (e.g.,
"East").
Building Dashboards
In Power BI, dashboards are created in the Power BI Service by pinning visuals
from reports. However, you can create a report page that acts like a dashboard in
Power BI Desktop.
Example: Sales Report Page
1. Create a new report page in Power BI Desktop.
2. Add the bar chart (Sales by Category) and line chart (Sales by Month) from
above.
3. Add interactivity:
o Enable Cross-Filtering: Click a bar in the bar chart to filter the line
chart.
4. Customize:
o Add a Text Box for a title (e.g., "Sales Performance Overview").
o Use Slicers (e.g., for Region) to allow dynamic filtering.
Basic DAX Calculations
DAX (Data Analysis Expressions) is used for creating custom calculations in Power
BI.
Example: Calculate Total Sales
1. Go to the Data view, select the table, and click New Measure.
2. Enter:
Total Sales = SUM(sales_data[Sales])
1. Use the measure in a Card visual to display the total sales value.
Example: Calculate Profit Margin
1. Create a new measure (assuming a Profit column exists):
Profit Margin = DIVIDE(SUM(sales_data[Profit]),
SUM(sales_data[Sales])) * 100
1. Use the measure in a bar chart to show profit margin by category.
Example: Year-over-Year Growth
1. Create a measure for year-over-year sales growth:
YoY Sales Growth =
DIVIDE(
SUM(sales_data[Sales]) - CALCULATE(SUM(sales_data[Sales]),
PREVIOUSYEAR(sales_data[Order_Date])),
CALCULATE(SUM(sales_data[Sales]),
PREVIOUSYEAR(sales_data[Order_Date]))
) * 100
1. Use it in a line chart to visualize growth over time.
Common Power BI Features
Power Query Editor: Transform and clean data before loading.
Visualizations Pane: Choose from charts, maps, tables, and more.
Filters Pane: Apply filters at the visual, page, or report level.
Slicers: Interactive filters for users.
DAX: Create measures and calculated columns for advanced analytics.
Power BI Service: Share and publish reports online.
Practice Exercises
1. Connect to a CSV file with student data
(e.g., student_id, name, grade, subject) and create a bar chart of average
grades by subject.
2. Create a line chart showing sales trends by month for a specific region.
3. Build a report page combining a bar chart and a line chart with a slicer
for Category.
4. Create a measure to categorize sales as "High" (>1000) or "Low" (≤1000).
5. Use a parameter (via What-If Parameter) to dynamically adjust a sales
threshold in a visualization.
Example Solutions
Exercise 1: Bar Chart of Average Grades
1. Connect to [Link] (columns: student_id, name, grade, subject).
2. Select a Clustered Bar Chart.
3. Drag Subject to Axis and Grade to Values.
4. Set Grade to Average (right-click Grade > Average).
5. Enable data labels and customize colors.
Exercise 2: Sales Trend by Month
1. Select a Line Chart.
2. Drag Order_Date (set to Month) to Axis and Sales to Values.
3. Add a filter for Region (e.g., "East") in the Filters pane.
Exercise 3: Sales Report Page
1. Create a new report page.
2. Add the bar chart (Sales by Category) and line chart (Sales by Month).
3. Add a Slicer for Category to allow dynamic filtering.
4. Enable cross-filtering between visuals.
Exercise 4: Categorize Sales
1. Create a measure named Sales Category:
Sales Category = IF(SUM(sales_data[Sales]) > 1000, "High", "Low")
1. Use Sales Category in a visual (e.g., color by category in a bar chart).
Exercise 5: Dynamic Threshold Parameter
1. Go to Modeling > New Parameter > What-If Parameter.
2. Create a parameter named Sales Threshold (Range: 500 to 2000,
Increment: 100).
3. Create a measure:
Above Threshold = IF(SUM(sales_data[Sales]) > [Sales Threshold Value],
"Above", "Below")
1. Use Above Threshold in a visual (e.g., color or filter).
Conclusion
This material provides a foundation for learning Power BI. Practice these examples
in Power BI Desktop to build proficiency. For advanced topics, explore Power
Query transformations, advanced DAX functions, or integration with Power BI
Service for sharing and collaboration.