Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Expert Data Modeling with Power BI

You're reading from   Expert Data Modeling with Power BI Get the best out of Power BI by building optimized data models for reporting and business needs

Arrow left icon
Product type Paperback
Published in Jun 2021
Publisher Packt
ISBN-13 9781800205697
Length 612 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Soheil Bakhshi Soheil Bakhshi
Author Profile Icon Soheil Bakhshi
Soheil Bakhshi
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Section 1: Data Modeling in Power BI
2. Chapter 1: Introduction to Data Modeling in Power BI FREE CHAPTER 3. Chapter 2: Data Analysis eXpressions and Data Modeling 4. Section 2: Data Preparation in Query Editor
5. Chapter 3: Data Preparation in Power Query Editor 6. Chapter 4: Getting Data from Various Sources 7. Chapter 5: Common Data Preparation Steps 8. Chapter 6: Star Schema Preparation in Power Query Editor 9. Chapter 7: Data Preparation Common Best Practices 10. Section 3: Data Modeling
11. Chapter 8: Data Modeling Components 12. Chapter 9: Star Schema and Data Modeling Common Best Practices 13. Section 4: Advanced Data Modeling
14. Chapter 10: Advanced Data Modeling Techniques 15. Chapter 11: Row-Level Security 16. Chapter 12: Extra Options and Features Available for Data Modeling 17. Other Books You May Enjoy

Extracting numbers from text

Another common data preparation step is when we need to extract a number from text values. An excellent example is when we want to extract a flat number or a zip code from an address. Other examples include extracting the numeric part of a sales order number or cleaning fullnames of typos, such as when some names contain numbers. In our scenario, we want to add two new columns to the Customer table, as follows:

  • Extract Flat Number as a new column from AddressLine1
  • Extract the rest of the address, Street Name, as a new column

The AddressLine1 column reveals that the flat number appears in different parts of the address; therefore, splitting by transitioning from digit to non-digit would not work:

Figure 5.43 – Flat Number appears in different places in AddressLine1

To achieve our goal, we need to extract the numbers from text. To do so, we can use the Text.Select(Text as nullable text, SelectChars as any...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime