Power BI - Add Column By Example
This feature allows you to create new columns of data from existing columns or cleaning data in your data model. It allows you to add new columns of data to your model by simply providing one or more sample values for your new column. Using column by example allows for you to complete transformations on data without needing to know the formulas. Examples of this could be trimming blank spaces, or getting just part of a string, or concatenating data from different columns. In more complex examples you need to provide power query a few examples, so it can learn what you are trying to do.
How to use this feature
Use Query Editor
A. Click Add column
B. Choose column by example
C. Select from all columns or from selection. This will add a new column
As you type, it will show you a preview of the transformation that will be applied. In the example below, you will see that we are extracting the everything before the - character in CUSTCLAS using the Text before delimiter transformation.
You will then have to rename the column
This is a nice tool for cleaning data quickly and the best thing is that it also works in excel using power query. If you would like to learn more reach out to the