Reader small image

You're reading from  Data Cleaning with Power BI

Product typeBook
Published inFeb 2024
PublisherPackt
ISBN-139781805126409
Edition1st Edition
Right arrow
Author (1)
Gus Frazer
Gus Frazer
author image
Gus Frazer

Gus Frazer is a seasoned analytics consultant who focuses on business intelligence solutions. With over eight years of experience working for the two market-leading platforms, Power BI (Microsoft) and Tableau, he has amassed a wealth of knowledge and expertise. He also has experience in helping hundreds of customers to drive their digital and data transformations, scope data requirements, drive actionable insights, and most important of all, clean data ready for analysis.
Read more about Gus Frazer

Right arrow

Using native M functions

As highlighted earlier in this book, M, the language behind Power Query, offers a rich library of native functions designed for data transformation. Leveraging these functions can often be more efficient than custom code.

For instance, let’s say you need to standardize product names by converting them to title case. Instead of writing custom code, you can utilize the Text.ToTitleCase function, making your query more concise and performant.

Here is an example of doing just this:

let
    Source = ... // Your data source
    StandardizedData = Table.TransformColumns(Source, {"ProductName", Text.ToTitleCase})
in
    StandardizedData

In this code, we use the Table.TransformColumns function along with the Text.ToTitleCase function to standardize product names. Native functions are highly optimized for their specific tasks, resulting in more efficient and faster queries.

The...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Data Cleaning with Power BI
Published in: Feb 2024Publisher: PacktISBN-13: 9781805126409

Author (1)

author image
Gus Frazer

Gus Frazer is a seasoned analytics consultant who focuses on business intelligence solutions. With over eight years of experience working for the two market-leading platforms, Power BI (Microsoft) and Tableau, he has amassed a wealth of knowledge and expertise. He also has experience in helping hundreds of customers to drive their digital and data transformations, scope data requirements, drive actionable insights, and most important of all, clean data ready for analysis.
Read more about Gus Frazer