You are on page 1of 14

Introduction to Power Query & Power BI

January 9, 2020
Append data from different sheets of 1 Excel file

1. Open file “1.Appending data from different sheet (columns are same).xlsx”
2. Data  From Table  Close & load to  Only create connection
3. Repeat for all tables
4. New query  Combine queries  Append
5. Select all tables that you want to ‘Append’
6. Close & Load

All data should be in the form of smart tables


Combine multiple sheets in one go without creating links

1. Open file “2. Combine multiple Excel Sheets in 1 go.xlsx”


2. Data  New query  From other sources  Blank query
3. =Excel.CurrentWorkbook()
4. Expand Columns
5. Remove columns by Right Clicking on columns
6. Close & Load

It is Case Sensitive
All sheets to have same columns
Importing from web

1. Data  New query  From other sources  from website


2. www.forex.com.pk
3. Close & Load
VLOOKUP in Power Query

1. Open file “3. VLOOKUP or Power Query.xlsx”


2. Create connections for both tables (Data  From table  Close & Load to  only
create connection)
3. New Queries  combine queries  Merge
4. Select both columns & identify the primary columns in both tables
5. Expand columns & remove columns that are not required by right clicking
6. Close & Load

Repeat the exercise by selecting the different table first & note the change in # of
rows
Splitting the columns

1. Open file “4. Splitting columns.xlsx”


2. Data  From table  Transform  Spilt column  By delimiter
3. Close & Load
Merge columns

1. Open file “5. Merging Columns.xlsx”


2. Data  From table  Transform (Select Columns that you want to merge ) 
Merge column
3. Close & Load

In Excel ‘Concotenate’
Merge columns by condition

1. Open file “5.1 Merge tables by condition.xlsx”


2. Make connections to both tables:
3. Data  From table  Close & Load to  create connection only

4. Data  New query  Combine queries  Merge: select tables, identify the
primary key, & select from Join Kind (Inner, Full outer)

Also talk about Replace, Fill up, Fill


down from Transform
Group by

1. Open file “8. Grouping.xlsx”


2. Data  From table
3. Group by
4. Select columns & practice ‘basic’ & ‘advance’ function
5. Close & Load

Use group function to get 1 column & 2 columns data


Also RANK the data
Un pivot tables

1. Open file “7. Power Query Unpivot.xlsx”


2. Select all columns that need to be ‘un pivot’ (including blank)
3. Data  From table
4. Remove un necessary columns & Rows
5.  Transform (select columns to unpivot)  unpivot
6. Close & Load

Use first Row as header


Transpose by

1. Open file “9. Transposition.xlsx”


2. Data  From table  Transpose
3. Close & Load

Use group function to get 1 column & 2 columns data


Making a Pivot table by Splitting column & “Refreshing Data”

1. Open file “Z_split & power pivot.xlsx”


2. Goto cell A8
3. Data  From table  Transform  Split Columns by Delimiter ( / )
4. Close & Load
5. Insert  Pivot Table (make Pivot table)
6. Now go to earlier sheet & paste data from E4:F119 below the original data
7. See if pivot table is updated (if not refresh data)
Loading data from Folders, Defining Data Model & Power Pivoting

1. Open file “Z_from folder.xlsx”


2. Data  New Query  From File  From Folder (set the path)
3.  Edit : set case lowercase for column ‘Extension’ ALSO apply filter to ‘Extension’
to select only .txt files
4. Click on ‘Content’ column  Remove other columns
5. Click on ‘Combine all’ on the top right corner of column ‘Content’
6. Select delimiter ‘Tab’
7. Close & load to: only create connection & add this data to the Data Model
8. Click on ‘Data Model (Go to the Power Pivot Window)’ – to view the first few Rows
9. Go back to “Z_from folder.xlsx” & convert this data to smart table ctrl+T
10. Go to  Power Pivot  Add to the data model  Diagram View
11. Managers & Sales Rep are the same
12.  Pivot Table : (Now we have 2 tables in the Pivot)
13. Now copy 2017 data into main folder & Refresh

You might also like