Data Types in Power BI
Data Types in Power BI
Data Type
Data Type represents the type of information stored in the memory location or
Column. Each column should have only one Data Type.
Change Data Type of a Column in Power BI
When you import or load a table from any data source, Power BI will automatically
detect the data type of a column. However, there may be some situations where Power BI
might get them wrong. For example, it may consider amounts, values, or even dates as the
text. Now we will see how to Change Data Types of a Column in Power BI with example.
Changing data type of the column is important as DAX functions have special data type
requirements and also filtering options will change based on data type of the column.
In Query Editor or Power Query you can change the Data Type of a column in different
ways.
Approach 1
In the below image for Units Sold Column, Power BI identified it as string column. But
actually we have Decimal Numbers as that column values.
So to change the data type, select the Column for which you want to change the data
type. Next, click on the left corner of the column header which is marked in Red Box. Then
select the data type which is appropriate, here Decimal Number.
Changing data type of a column will open the following pop up window. You can
Choose “Replace Current” to update current step or also you can choose “Add new step” to
add a new transformation step to the Query.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Approach 2
Select the Column name that you want to alter the data type, and click on the Data
Type button under the Home tab in Power Query Ribbon.
Approach 3
Select the Column that you want to change the data type and right-click on it will
open the context menu. Select the Change Type and then select the data type from the list.
For now, we are selecting the Decimal Number.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Be careful if you are filtering the rows using Search Bar. Always look at the M code
return by Power Query and cross check it is filtering as expected.
Basic Filtering is good only if you want to do equity filtering for values that exists in
the current data set, however it won’t work correctly if you want to check ranges, or contains
or things that is not an exact equity filter. Advanced Filtering is the correct way of filtering in
Power Query, and there are advanced filters for all types of data types; Numbers, Text,
Date…
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you filter a column, only the top 1,000 distinct values in the column will load
into the filter list. If there are 1,000 or more values in the column in Query Editor that you
are filtering, a message will appears indicating that the list of values in the filter list may be
incomplete, and the Load more link is shown. Click the Load more link to load another 1,000
distinct values.
If exactly 1,000 distinct values are found again, the list is displayed with a message
stating that the list could still be incomplete.
If less than 1,000 distinct values are found, the full list of values is shown.
Filter a Column using Text Filters
In addition to the “Auto Filters” or Basic Filtering, you can filter a Text values using
the Text Filters context menu.
Click the down arrow ( ) of the column containing a Text values you want to filter on.
Click Text Filters and select the filter option required from Context Menu.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
In below image we applied filters on Row ID and Customer Name Column and you can
see M Language Code.
www.abtrainings.com