Microsoft Power BI Bootcamp LearniT
“Genius is one percent inspiration, ninety-nine percent perspiration” – Thomas Edison Does this sound like you? Grab data from one or more sources Prep data (often using VLOOKUP) Create Pivots over the prepared data Create reports from Pivot data (sometimes the Pivots ARE the reports) Share with colleagues via email or network drive Spend at least half of time re-creating these reports, updated with the latest data, on a recurring basis The world is changing in our favor
Data Modelling (Power Pivot) Power BI Excel Power BI Dashboards Stunning Visuals Mobile Consumption Alerts & Live Data Excel Pivot Tables Pivot Charts OLAP Tools VBA DAX Functions Data Modelling (Power Pivot) ETL (Power Query)
Day 1 By the end of today… By the end of the day, we will have transformed local data, web data, and a little curiosity into stunning visual analysis and business insights. Student will actual make the reports on this slide by the end of the day.
Our GOALS today are… Analyze our company’s Wages and Sales across the United States Perform multiple Analysis to discover insights Visualize Analysis to make it “consumable” To achieve this we’ll need to 1. Fetch data from the MANY different places we keep it 2. Clean up the data so we can analyze it 3. Use Power BI to discover insights 4. Learn to use different visual types 5. Organize our insights into a convenient report
Today we are going to cover Getting Started What is Power BI? Getting the Tools Power BI and Excel Discovering Insights with PBI (Data Analysis Objectives) PBI Eco-System Getting and Transforming Data with Power Query Concepts and Objectives Importing from Various Sources Appending and Merging Queries together Data Normalizing Strategies Reusing Queries Introduction to Power BI Desktop Concepts (Power BI compared to Excel) Importing Data from Excel Issue Queries Directly from Power BI Building Reports Creating Simple Visualization Telling a Story with your PBI Reports Creating Slicers Using Charts as Slicers
Get & Transform (aka Power Query) Extract Transform Load 1 2 3 4 5 6 7 8 9 Power Query is what is known as an ETL tool. ETL = Extract, Transform and Load Extract: connect to data from various places Transform: format and organize your data so it is ready for analysis. Power Query memorizes all of your normalization preferences so it can repeat them. Load: Load the data to Excel and throw it in a Pivot Table. OR load it as a “Connection Only” for later use with other data. OR load it straight to your data model for multi-dimensional analysis!
Normalizing Concepts Smallest Meaningful Value Break down the fields to their smallest meaningful value. Columns with last and first names need to be broken down into separate columns with first name, and last name. Remove Un-Necessary Data Any columns or rows that are meaningless, or will not be used for your analysis should be removed. Errors Different kinds of errors should be handled differently, but they should all be addressed before moving on Compliant Field Names You don’t want field names with weird characters (gets in the way of formulas and functions). Additionally, it is best for fields to (columns) have names that explicitly refer to the kind of content contained there. Relatable fields should be named the same between data sets (or named something very similar) to avoid headaches down the road. Standardize Data A lot of data comes in with interfering characters, like dollar signs, or spaces that will interfere with analysis. Standardize Data Types Make sure each column has the appropriately applied data type. Numbers = numbers, dates = dates, currency, text, etc. Create Key / ID Fields If you are later going to be making relationships between data sets, it is wise to add key columns with identifying numbers or ID’s that can later be used to establish relationships. Using Power Query for Normalizing Power Query has a lot of normalizing strategies that require a lot less time and energy that performing the same tasks in Excel.
LAB – Building Reports Revenue – Actual vs. Projected 1hr Revenue – Actual vs. Projected Page ___ of the Student Guide Wage vs. Revenue Comparison Page ___ of the Student Guide
Day 2 By the end of today… By the end of the day, we will take data from many sources and relate and model to have a comprehensive related set of data.
By the end of today… Day 2 Mobile Consumption By the end of the day, we will take multiple reports and publish them to the web. Student will make the dashboard on this slide by the end of the day.
Our GOALS today are… Analyze our Sales, Profits, and Returns over time See these analysis segmented by Product, Product Subcategory and Product Category Visualize the analysis Share the analysis in a consumable Dashboard To achieve this we’ll need to 1. Combine yesterday’s geography data with our company’s transaction history (new data) 2. Create some measures for our desired analysis 3. Put this data on a time scale (calendar table) 4. Visualize the analysis
Today we are going to cover Data Modeling Concepts of Power Pivot and "Data Model" in Excel Importing Data from Various Sources Modelling & Relating Concepts of creating a Data Model (Decision Structures) Creating Relationships Creating Calculated Columns Designing Measures Building Hierarchies Data Analysis Strategies Power BI Importing a Data Model from Excel Data Modelling directly in Power BI Importing Additional Data Creating Calculated Columns and Measures in Power BI DAX expressions Power BI Cont. Introduction to Time Intelligence Calendar Tables Essential Time Intelligence DAX expressions Building Interactive Reports Concepts: Reports for Consumption Disconnecting Visuals Drilling Down with Hierarchies Power BI Online Dashboards vs. Reports Pinning Visuals Excel Objects Online Publish and Share Dashboards and Reports Using Q&A Designing for Better Q&A
Our Data Model Our Data Model Looks like this Product Category Geography Product Subcategory Stores Product FactSales Channel Promotion
Data “Model” Basic Structure Lookup Table Data Table Fact Table Transaction Table Lookup Table Lookup Table Lookup Table Flow of Information
Real-World models look more like
What is a Measure? This is a measure These are measures One Number Many Numbers This is a measure These are measures One Number Measures are a mathematical aggregation. A measure takes many numbers and collapses them down to a single value. That’s how summary happens.
No “Naked” Measures Total Sales = Fact Sales [ Sales Amount] Because measures are designed to take MANY numbers and condense them into a single value, they must always have an aggregation function wrapped around columns of data. Total Sales = Fact Sales [ Sales Amount] Total Sales = SUM ( Fact Sales [ Sales Amount] )
Profit Margin = Total Profit / Total Sales Nesting Measures Total Profit Total Sales “Ancestor Measures” Profit Margin = Total Profit / Total Sales “Derived Measures”
Let’s Keep a Measure Map Total Profit Total Sales Total Transactions Days Selling Total Margin Sales per Transaction Sales per Day
% Transactions Refunded Measure Map Total Sales Total Profit Total Transactions Days Selling Refunds Promo Sales Regular Sales Total Margin Sales per Transaction % Total Sales Refunded Sales per Day Net Sales % Sales on Promo % Sales No Promo % Transactions Refunded
CALCULATE Will likely be your favorite function Think of it like the SUMIF = CALCULATE ( FUNCTION ( Table[Column] ) , Table[Column] = ThingtoFilterFor ) SUM IF
CALCULATE (using measures instead of functions) If you have a measure already made, you can use it instead of a function = CALCULATE ( [ MEASURE ] ) , Table[Column] = ThingtoFilterFor ) SUM IF
Measures to CALCULATE Total by “Promo” Sales not on Promo Table: FactSales Measure Name: RegularSales Formula: = CALCULATE ( [TotalSales] , FactSales[PromotionKey] = 1 ) Format: Currency Sales NOT on Promo Table: FactSales Measure Name: PromoSales Formula: = CALCULATE ( [TotalSales] , FactSales[PromotionKey] <> 1 ) Format: Currency Let’s create a couple measures to determine Total Sales ON Promo, and Total Sales not on Promo
Measures to CALCULATE % Promo % Sales Not on Promo Table: Fact Sales Measure Name: % Sales NoPromo Formula: = [RegularSales] / ( [TotalSales] ) Format: Number, Percent % Sales ON Promo Table: Fact Sales Measure Name: % Sales OnPromo Formula: = [PromoSales] / ( [TotalSales] ) Format: Number, Percent Students can try to make these themselves.
LAB Analysis Measures Objective: build measures to accomplish the following Aggregate Refunds (SUM RefundAmount) Net Sales (Total Sales – Refunds) Percent of Total Sales that was refunded Percent of Total Transactions that were refunded
LAB – Analysis Measures Refunds Table: FactSales Measure Name: Refunds Formula: = SUM ( FactSales[ReturnAmount] ) Format: Currency NetSales Table: FactSales Measure Name: NetSales Formula: = [TotalSales] - [Refunds] Format: Currency Percent of Sales Refunded Table: FactSales Measure Name: % TotalSales Refunded Formula: = [Refunds] / [TotalSales] Format: Percent Percent Transactions Refunded Table: FactSales Measure Name: % Transactions Refunded Formula: = CALCULATE ( COUNT ( FactSales[ReturnAmount]) , FactSales[ReturnAmount] > 0 ) / COUNT ( FactSales[ReturnAmount]) Format: Percent 15min
LAB – Analysis Measures Percent Transactions Refunded Table: FactSales Measure Name: % Transactions Refunded Formula: = CALCULATE ( COUNT ( FactSales[ReturnAmount]) , FactSales[ReturnAmount] > 0 ) / COUNT ( FactSales[ReturnAmount]) Format: Percent This measure has no ancestor dependencies. If you preferred, how would you change it to have ancestor dependencies?
LAB – Analysis Measures % UnitsSold that were Refunded Transactions per Day Selling Transactions per Day Ask Garrett and Cara to suggest some! IF YOU WOUD LIKE, these are additional measures that can be tried
Let’s do this in Power BI
% Transactions Refunded Measure Map Total Sales Total Profit Total Transactions Days Selling Refunds Promo Sales Regular Sales Total Margin Sales per Transaction % Total Sales Refunded Sales per Day Net Sales % Sales on Promo % Sales No Promo % Transactions Refunded
Calendar Tables should have the following At least one column of “date” data type Contain exactly one row per day Completely consecutive gaps (don’t skip weekends, even if you’re closed) Be related to your Data Tables (Sales) Contain columns for all of your desired groupings (like MonthName) Ideally only spans the dates of your business
Calendar & Calendar Auto Calendar ( StartDate , EndDate )
Smart Calendar Function CALENDAR ( StartDate , EndDate ) DATE( YEAR( MIN( DateField ) ), MONTH( MIN( DateField ) ), DAY( MIN( DateField ) ) ) DATE( YEAR( MAX( DateField ) ), MONTH( MAX( DateField ) ), DAY( MAX( DateField ) ) )
Add the Meta Data in columns Year = Year ( Dates [ DateKey ] ) MonthNum = Month ( Dates [ DateKey ] ) MonthName = Format ( Dates [ DateKey ] ), “MMMM” ) MonthNameAbrv = Format ( Dates [ DateKey ] ), “MMM” ) DayofMonthNum = Day ( Dates [ DateKey ] ) DayName = Format ( Dates [ DateKey ] ), “DDDD” ) DayNameAbr = Format ( Dates [ DateKey ] ), “DDD” ) WeekdayNum = Weekday ( Dates [ DateKey ] ) QuarterNum = ROUNDUP( MONTH( Dates [ DateKey ] )/3 , 0 ) QuarterName = CONCATENATE( “Qtr ” , Dates[QuarterNum] ) Month & Year = CONCATENATE( Dates[MonthNameAbrv] &“ “, Dates[Year] ) Year & Month = Dates[Year] & Dates[MonthNum]
LAB 1 Lab 2 – Make your Own Promotion / Sales Correlation Analysis Profit Which product categories have the highest profit margins? Which product generate the most dollars in profit? What correlations can be drawn here? Compare Profit in each month, to the profit margin in each month. (Column and Line chart) Refunds What portion of total sales is refunded? Which Product Category has the most refunds? The highest refund amount? The highest refund:sales ratio? What time of year brings in the most refunds? Is there any correlation between promotions being run and refunds? Sales & Transactions Which days typically have the highest number of transactions? Which days have the highest sales typically? Are the monthly sales trends consistent each year? Which months sell the best? How does this compare to the promotions being offered at the time? Which Product Category is been declining in sales? Which has been steady? Locations Which locations have been selling the best? Which locations have the highest refunds? Which locations have the highest profit margin? Which locations have the most transactions? Transaction to profit ratio? 45min Promotion / Sales Correlation Analysis Page ___ of the Student Guide
Measure Map Total Discount Total Sales Total Profit Total Transactions Days Selling Refunds Sales : Discount Ratio Promo Sales Regular Sales Total Margin Sales per Transaction Sales per Day Net Sales % Total Sales Refunded Promo Sales YTD % Sales on Promo % Sales No Promo
Day 3 By the end of today… By the end of the day, we will have transformed local data, web data, and a little curiosity into stunning visual analysis and business insights. Student will actual make the reports on this slide by the end of the day.
Our GOALS today are… To achieve this we’ll need to 1. Fetch data from the MANY different places we keep it 2. Clean up the data so we can analyze it 3. Use Power BI to discover insights 4. Learn to use different visual types 5. Organize our insights into a convenient report
Today we are going to cover… Querying SharePoint Lists UnPivot Data Re-Using M Script Grouping Data Writing M Script Calendar Tables with M Custom Calendars (445) Custom Functions in Power Query Time Intelligence in Depth DatesToDate Functions YTD QTD MTD DATEADD FIRSTDATE and LASTDATE ENDOFMONTH, STARTOFYEAR CLOSING BALANCE MONTH. QUARTER, YEAR DATESBETWEEN
Un-Pivoting Data – Examples of Bad Data Sometimes the data is actually a Pivot Table Sometimes a person just subtotaled manually
Un-Pivoting Data - Result Example from Chandoo
The Principle of Un-Pivoting Data Any Data that looks like this… Should be turned in to this
Storyboard – draw lines for story connections UnPivot & Copying Script Data: Competitor Data Tool: PQ M Script Data: Competitor Data Tool: PQ
Measure Map First Date Last Date Total Discount Total Sales SalesYTD Sales Fiscal YTD Sales MTD Sales QTD Total Sales Prev Month First Date Sales Growth by Month Last Date Total Discount Total Sales Total Profit Total Transaction Days Selling Refunds End of Period Sales : Discount Ratio Promo Sales Regular Sales Total Margin Sales per Transaction Sales per Day Net Sales % Total Sales Refunded Promo Sales YTD % Sales on Promo % Sales No Promo
Day 4 By the end of today… By the end of the day, we will have transformed local data, web data, and a little curiosity into stunning visual analysis and business insights. Student will actual make the reports on this slide by the end of the day.
Our GOALS today are… To achieve this we’ll need to 1. Fetch data from the MANY different places we keep it 2. Clean up the data so we can analyze it 3. Use Power BI to discover insights 4. Learn to use different visual types 5. Organize our insights into a convenient report
Today we are going to cover…