- In this article, we learn about the Column From Example option in Power Query Editor.
- We can create the new column examples from a selection, or provide input based on all existing columns in the table.
COLUMN FROM EXAMPLE
- Column From Example helps to create a new column in the table by using a table.
- The Column From Example has two options:
→ From All Columns
→ From Selection
- Firstly we need to load the table in Power BI by using Get Data.
- To open Power Query Editor goto the Home tab in that click on Edit Queries.
- After that Power Query Editor window is open. Then go to Add Column here we can see the Column From Examples option.
- Now we do some examples on it.
EXAMPLE 1: CAPITALIZE EACH WORD
- First, we select the column then go to Column From Examples option and choose From Selection.
- Thereafter new column is open in that we can enter the name which is related to the selected column. Here we enter Maria.
- For executing press Ctrl+Enter and click on ok button.
- Then it will automatically enter all the values related to the selected column.
- We can enter the first letter of maria in the upper case so it applies the same thing on the selected column.
EXAMPLE 2: DAY NAME
- Now we select the DOB column and in the Column From Examples select From Selections.
- When we click on the blank row from column1 then a new window is open it shows all the information about the date.
- Here we select Day of Week Name and for applying we do Ctrl+Enter then click on ok button.
- After that, all Day names related to the dates are shown on the screen.
EXAMPLE 3: MERGE
- In this example, firstly we go to Column From Examples then select From All Columns.
- Thereafter we enter the sentence related to columns.
- Again we applying the same thing that is Ctrl+Enter and click on ok button.
- Then the result is shown on the screen.
EXAMPLE 4: TEXT BEFORE DELIMITER
- Now we do Text Before Delimiter on the selected column. If we want to change the name of the column it possible by double click on the column.
- Then the result is shown on the screen.
If you are new to Power BI start with the following must-watch video:-