Locked lesson.
About this lesson
No data manipulation tool would be complete without the ability to use conditional logic. In this lesson we will explore the benefits of Power Query's user interface driven "Conditional Column" tool.
Exercise files
Download this lesson’s related exercise files. You can download source data files for the course from the resources section of your Lessons page.
Basic Conditional Logic.xlsx19.3 KB Basic Conditional Logic - Completed.xlsx
26.6 KB
Quick reference
Basic Conditional Logic
An introduction to Conditional Logic in Power Query.
When to use
When you need to create a new column based on a set piece of conditional logic (if/then type of statement).
Instructions
Getting Started
- Create a new query to bring your data to Power Query
Creating Conditional Columns
- Go to the Add Column tab --> Add Conditional Column
- In the Add Conditional Column dialog, name the column and create the logic
Finishing the Query
- Apply transformations as required
- Set data type for each column
- Rename the query
- Close & Load the query
Hints & tips
- Compare against or return the output from columns by changing the drop-down boxes marked ABC123 to “Select a Column”
- Remove or re-order a logic statement in the Add Conditional Column Dialog by clicking on the ellipse (…) next to the statement and choosing the appropriate option
- To fill a cell with an empty value, use the keyword “null” (must be lowercase)
- The Fill command copies the value into cells containing “null” until a cell with a different value (including blank) is reached
Lesson notes are only available for subscribers.