8. Adding Columns: Power Query Add Column Tab and DAX Calculated Columns
8.2 Column From Examples
You type the answer, and Power Query works out the formula.
Steps in Power BI
- Select the column(s) to use, for example Customer Name (values like "Shraddha Bagale").
- Add Column › Column From Examples › From Selection (or From All Columns).
- In the new empty column type
Shraddhain the first row and press Enter. Power Query fills the other rows and shows the formula at the top (Text Before Delimiter " "). - If a row is wrong, type the correct value in that row too. Two or three examples are usually enough.
- 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.
Ravindra Bagale's Tip – मराठी
एक गोष्ट लक्षात ठेवा: formula न वाचता Column From Examples ची पहिली suggestion स्वीकारणं धोकादायक आहे. ती preview rows साठी चालेल पण इतर rows साठी fail होऊ शकते (उदाहरणार्थ space नसलेली नावं). दोन-तीन examples type करा, मग OK करण्याआधी वरती दिसणारा formula वाचा. हे exam आणि interview दोन्हीसाठी important आहे.
Ravindra Bagale's Tip – हिंदी
एक बात याद रखो: formula पढ़े बिना Column From Examples का पहला suggestion मान लेना जोखिम भरा है. वह preview rows पर चल सकता है पर दूसरी rows पर fail हो सकता है (जैसे बिना space वाले नाम). दो-तीन examples type करो, फिर OK करने से पहले ऊपर दिखाया गया formula पढ़ो. यह exam और interview दोनों के लिए ज़रूरी है.
Practice task
From Store ID "BLK-PUN-KOT-01", use Column From Examples to get the City Code "PUN".