Column From Examples- The Bee(I)'s Knees!

Testin macro capabilities of Panasonic Lumix LX15
Photo by Massimiliano Latella / Unsplash

Today, our cohort received a comprehensive introduction to both Power BI and Power Query, which are essentially Microsoft's counterparts to Tableau and Alteryx. While each tool has its own set of strengths and weaknesses, we were all particularly impressed with a remarkable feature within Power Query.

Column From Examples stands out as a groundbreaking tool that enables users to generate new columns by simply providing examples of the desired output. This feature leverages the ease of human input, making it accessible even to those with limited coding knowledge in data transformations!

After bringing in a dataset into Power BI, in the Home section, click on Transform Data.
This will take you to Power Query, in the Add Column section, click Column From Examples.

To use this feature, you simply start typing your desired output. It's important to note that Power Query may not get everything right immediately. You may need to provide examples in about 2 to 5 unique rows for the software to fully understand your requirements.

Column From Examples offers an extensive list of transformations. Here are a few that I believe everyone will find particularly useful:

String transformations


There are many different ways we would want to change a string/text column. For example, let's say we work for a large retailer and we have a lot of customer/sales data.

We can pick out important information from a long code! (Here, I only typed in one row)
We can combine fields (columns) to create new ones!
We can create new codes by shortening/lengthening existing fields! (Both of these only required two rows to be completed)

Date & Time transformations

There are multiple ways to transform the date, e.g we can truncate the full date to a shortened day of the week!

Number transformations


Again, there are many number transformations from basic operations, rounding, numeric manipulations, trigonometric functions, odd/even checks and ranges!
In this example, I put the order quantities into ranges, then gave them categories!

This is just a small taste of what Column From Examples can do!

It is always useful to understand the types of transformations Power Query performs in order to complete Column From Examples requests. You can use the solution generated in Power Query, using it's coding language M, to help you understand the process, as well as giving ideas about the calculations in Alteryx and Tableau Prep.

In summary, the Column from Examples tool in Power Query is a user-friendly feature that simplifies data transformation. It learns from your examples to apply consistent transformations, saving time and improving data analysis. It's a valuable addition to your toolkit, making data preparation more efficient and enhancing your insights. Give it a try and experience the benefits for yourself!

Author:
Harvey Joyce
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab