2 - Power BI - Query Editor - Column Transformation - Data Types
2 - Power BI - Query Editor - Column Transformation - Data Types
2009 to 2016 OR
3. Select the column you want to unpivot, then click
on ‘Transform’ → ‘Any Column’ → Unpivot
Columns → Unpivot Only Selected Columns
Pivot the
Unpivoted Column
◦ Select ‘Attribute’ Column to unpivot it once
again as it was before.
◦ Click on ‘Transform’ → ‘Any Column’ →
‘Pivot Column’
◦ Select Value Column as ‘Value’
◦ Under ‘Advance Aggregate Value function’
select ‘Don’t Aggregate’
◦ Click on ‘Ok’
TRANSPOSE
COLUMNS
Transpose Columns ◦ Transposing a data set is ultimately rotating data
from rows to columns, or from columns to rows.
Transpose
Columns
◦ To Transpose columns:
◦ Go to : Home → Recent Sources
◦ Click on recently imported file in list named
‘Column_Row Trnsformations.xlsx’
◦ Select table name ‘transpose2’
◦ Click on ‘Ok’
Transpose
Columns
◦ To bring header as first
row: Go to → Transform
→ Table → Select ‘Header
as First Row’
Transpose
Columns
◦ Select ‘Transform’ →
‘Table’ → ‘Transpose’
Transpose
Columns
◦ Now select → ‘Transform’
→ ‘Table’ → ‘Use First
Row as Headers’
COLUMN ‘DATA
TYPES’
Column – Data Types
◦ For performing mathematical operation you need to check data
type of the Column
◦ Data types supported by Microsoft is as shown in image:
Data Type – ‘Decimal Number’
◦ Decimal Number – Represents a 64 bit (eight-byte) floating point
number. Although designed to handle numbers with fractional
values, it also handles whole numbers. The Decimal Number type
can handle negative values from -1.79E +308 through -2.23E -308,
0, and positive values from 2.23E -308 through 1.79E + 308. For
example, numbers like 34, 34.01, and 34.000367063 are valid decimal
numbers. The largest value that can be represented in a Decimal
Number type is 15 digits long. The decimal separator can occur
anywhere in the number. The Decimal Number type corresponds to
how Excel stores its numbers.
Data Type – ‘Fixed Decimal Number’
◦ Fixed Decimal Number – Has a fixed location for the decimal
separator. The decimal separator always has four digits to its right
and allows for 19 digits of significance. The largest value it can
represent is 922,337,203,685,477.5807 (positive or negative). The
Fixed Decimal Number type is useful in cases where rounding might
introduce errors. When you work with many numbers that have
small fractional values, they can sometimes accumulate and force a
number to be slightly off. Since the values past the four digits to the
right of decimal separator are truncated, the Fixed Decimal type can
help you avoid these kinds of errors. If you’re familiar with SQL
Server, this data type corresponds to SQL Server’s Decimal (19,4), or
the Currency Data type in Power Pivot.
Data Type – ‘Whole Number’
◦ Whole Number – Represents a 64 bit (eight-byte) integer value.
Because it’s an integer, it has no digits to the right of the decimal
place. It allows for 19 digits; positive or negative whole numbers
between -9,223,372,036,854,775,807 (-2^63+1) and
9,223,372,036,854,775,806 (2^63-2). It can represent the largest
possible number of the various numeric data types. As with the
Fixed Decimal type, the Whole Number type can be useful in cases
where you need to control rounding.
Data Type – ‘Percentage’
◦ Percentage was added as fourth numeric data type to the Query
Editor/M in November of 2016. Unlike whole number, fixed
decimal number, and decimal number, this type does not have a
corresponding type in the data model.
◦ When loaded to the data model, the percentage data type is
represented as a decimal number type.
Data Type – ‘Date/Time’
◦ Date/Time – Represents both a date and time value. Underneath
the covers, the Date/Time value is stored as a Decimal Number
Type. So you can actually convert between the two. The time portion
of a date is stored as a fraction to whole multiples of 1/300 seconds
(3.33 ms). Dates between years 1900 and 9999 are supported.
Data Type – ‘Date’
◦ Date – Represents just a Date (no time portion). When converted
into the model, a Date is the same as a Date/Time value with zero
for the fractional value.
Data Type – ‘Time’
◦ Time – Represents just Time (no Date portion). When converted
into the model, a Time value is the same as a Date/Time value with
no digits to the left of the decimal place.
Data Type – ‘Date/Time/Timezone’
◦ Date/Time/Timezone – Represents a UTC Date/Time.
Currently, it’s converted into Date/Time when loaded into the
model.
Data Type – ‘Duration’
◦ Duration – Represents a length of time. It’s converted into a
Decimal Number Type when loaded into the model. As a Decimal
Number type it can be added or subtracted from a Date/Time field
with correct results. As a Decimal Number type, you can easily use it
in visualizations that show magnitude.
Data Type – ‘Text’
◦ Text - A Unicode character data string. Can be strings, numbers, or
dates represented in a text format. Maximum string length is
268,435,456 Unicode characters (256 mega characters) or
536,870,912 bytes.
Data Type – ‘True/False’
◦ True/False – A Boolean value of either a True or False.
◦ Binary data types are used to store any kind of binary data
like images, word files, text files, etc. in table.
◦ Data types in the binary-strings category include:
◦ bit variables store a single bit with a value of 0, 1 or NULL.
Data Type – ◦ binary(n) variables store n bytes of fixed-size binary data. These
fields may store a maximum of 8,000 bytes.
Blank/Null ◦ NULL is not the number zero. NULL is not the empty string
(“”) value. Rather, NULL is the value used to represent an
unknown piece of data. A NULL is an unknown value in
which the field appears blank.
Data Type – ‘Any’
◦ When data type is undefined for a column