Ravindra BagaleCourses & study guides मराठी Track your progress

8. Adding Columns: Power Query Add Column Tab and DAX Calculated Columns

8.2 Column From Examples

Start with a problem

Ruhi needs a First Name column but doesn't remember Text.BeforeDelimiter.

Explain simply

Column From Examples: type the result you want for one or two rows; Power Query writes the formula. Check the formula it shows.

Show the data

Full Name
Ravindra Bagale
Shraddha Bagale
Ruhi Bagale
Salman

About this data: This table uses columns: Full Name, First Name. This table uses columns: Input, You type, Power Query suggests. This table uses columns: Wrong result, Reason, Correction. Values shown are the lesson examples already on this page (not a new dataset).

Fictional sample data. Practice file: pq_customers_text.csv (source: src/practice/).

Demonstrate

  1. Select Full Name › Add Column › Column From Examples › From Selection.
  2. Type Ravindra in the first row › Enter.

    Your result should look like this:

    Suggested values
    Ravindra, Shraddha, Ruhi, Salman
  3. Read the formula at the top, e.g. Text.BeforeDelimiter([Full Name], " "); click OK.

Show the result

Your result should look like this (fictional sample):

Full Name First Name
Ravindra Bagale Ravindra
Shraddha Bagale Shraddha
Ruhi Bagale Ruhi
Salman Salman

Explain what happened

Power Query found a rule that produces your example and applied it to all rows. Always check edge rows such as the single-word name Salman.

Explore further

  • Works for dates too: type April next to 06-Apr-2026 → Date.MonthName.

Detailed reference for this lesson:

You type the answer, and Power Query works out the formula.

Steps in Power BI

  1. Select the column(s) to use, for example Customer Name (values like "Shraddha Bagale").
  2. Add Column › Column From Examples › From Selection (or From All Columns).
  3. In the new empty column type Shraddha in the first row and press Enter. Power Query fills the other rows and shows the formula at the top (Text Before Delimiter " ").
  4. If a row is wrong, type the correct value in that row too. Two or three examples are usually enough.
  5. Rename the column (double-click the header in the dialog) to First Name › OK.
Input You type Power Query suggests
Blinkit Kothrud (Pune) Kothrud Text Between Delimiters " " and " ("
2025-10-20 21:47 Oct-2025 Date.ToText with format "MMM-yyyy"
480 400-499 A range (bucketing) formula

Ravindra Bagale's Tip

Remember one thing: accepting the first Column From Examples suggestion without reading the formula is risky. It may work for the preview rows but fail for others (for example names without a space). Type two or three examples, then read the formula shown at the top before clicking OK. This matters for both exams and interviews.

Practice task

From Store ID "BLK-PUN-KOT-01", use Column From Examples to get the City Code "PUN".

Fix common mistakes

Wrong result Reason Correction
Wrong rule guessed One example was ambiguous Type a second example
Salman shows blank or error The guessed rule expects a space in every row Check single-word rows; type a second example (Salman)
Can't edit later Thought it was magic Edit the generated M in the formula bar

Practise independently

Practice task

Use Column From Examples on Area City to get only the City (type Pune for row 1).

Hints
  • Text after -.
Solution

Pune, Nashik, Kolhapur, Nashik – formula Text.AfterDelimiter([Area City], "-").

Think like a professional

Always read the generated formula – you learn M and avoid hidden wrong rules.

Ravi Sir's Cards for this lesson

मराठी cards