From the course: Power BI Data Methods
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Adding data types in M code - Power BI Tutorial
From the course: Power BI Data Methods
Adding data types in M code
- [Instructor] If we look at the data where we get the hourly weather data measurements for the weather for Santa Barbara, we notice in the applied steps that there's a lot of different steps going on here before we get to our final result. One of these is that we change type five times. We change it initially when we connect the Source step and it converts all the fields that we see here to text. It also converts the data type when we add columns, and again, when we add other columns, and two more times after that. So while we'll still see the Change Type step for the second step in the Applied Steps list, we can remove a lot of these additional steps to change the type by putting them directly in the column formula. To do so, we'll go into the step where we added a particular column. At the end of this function, before the final closing parentheses, let's set our data type for this new field. So day is going to be a number, so we'll set this to the Number.Type, and notice how it's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Using conditional functions6m 28s
-
(Locked)
Transposing tables2m 50s
-
(Locked)
Grouping fields and values3m 46s
-
(Locked)
Merging and appending data5m 2s
-
(Locked)
Pivoting and unpivoting data5m 36s
-
(Locked)
Parameters5m 26s
-
(Locked)
Custom functions6m 38s
-
(Locked)
Adding data types in M code4m 25s
-
(Locked)
-
-
-