HELP IS AT HAND!

Link to compose email for help with website.Question, comment, critique? We are here to help and we strive to make our site a comprehensive, user friendly experience. Contact us at DARTS@maine.edu.

Transforming Data using the Query Editor

You might need to change data fields in order to perform data analysis. Here are some examples for transforming data.

Go to the Query Editor by choosing Transform > Transform data. 

Each action is automatically recorded under the "Applied Steps" box. When you need to modify the transformation you have done, go back to the step and change it from there. The "Applied Steps" box is very handy when you need to resolve errors.

Conditional Column

You can create a new column with your own rules.

  1. Select "Add Column" > Conditional Column
    Choose Conditional Column under the Add Column tab

  2. Enter new column name, and enter rules. If more rules are needed, click "Add Clause".
    Enter rules in the Add Conditional Column dialogue box
  3. Once all rules are entered, click "OK".

Custom Column

You can crate your own column. In this example, combine more than one columns.

  1. Go to "Add Column" > Custom Column
    Select Custom Column in the Add Column Tab
  2. Enter new column name and pick the column name from "Available columns"

  3. When you want to concatenate, use '&'.  Use double quote (") for adding text.
    Choose column name from available columns in the Custom Column Dialogue Box

  4. Make sure not to have any errors and click "OK"

    Note: If any of combined column is null, the returned field will be null. You can use code below on the formula box to fix the issue.

    = Text.Combine(List.Select({[Col1],[Col2],[Col3],[Col4]}, each _<> "" and _ <> null)," & ")

Extract

You can extract a part of your data. In this example, extracting last two characters of STRM data.

  1. Click and highlight the column you want to extract. (In this example, "STRM" was chosen)

  2. Go to "Add Column" > Extract > pick the function (In this example, "Last Characters" was chosen)
    Select Extract from the Add Columns tab

  3. Enter the number of characters to keep
    Enter number of characters to keep in the Insert Last Characters dialogue box
  4. It will create a new column. You can change the name of the column.

Replace Values

  1. Right click on the field column and choose "Replace Values"
    Choose Replace Values from a Right Click on the Field column

  2. Enter values
    Enter values in the Replace Values dialogue box

Remove Duplicates

  1. Click a small table icon before the first column field starts and choose "Remove Duplicates"
    Select table icon in the first column field heading and select Remove duplicates


Other transformation functions available in PBI Query Editor:

  • Remove columns/ Remove other columns/ Choose columns
  • Use first row as headers
  • Duplicate columns
  • Split columns
  • Replace values
  • Change data type
  • Group by
  • Unpivot columns
  • Rename columns
  • Uppercase/ Lowercase
  • Trim 
  • Capitalize each word

Related Pages:

Resource:

Book:

Collect, Combine, and Transform Data Using Power Query in Excel and Power BI