Microsoft Office Tutorials and References
In Depth Information
Inside DAX Data Types
DAX data types might be familiar to people used to working with Excel. However, we
need to review a few considerations about two of these data types because of the
frequency they are used in PowerPivot data models.
Date data type
PowerPivot stores dates in a datetime data type. This format uses a floating point
number internally, wherein the integer corresponds to the number of days (starting from
December 30, 1899) and the decimal identifies the fraction of the day. (Hours, minutes,
and seconds are converted to decimal fractions of a day.) Thus, the expression
= NOW() + 1
increases a date by one day (exactly 24 hours), returning the date of tomorrow at the
same hour/minute/second of the execution of the expression itself.
TRUE/FALSE data type
The data type TRUE/FALSE is used to express logical conditions. For example, a calculated
column defined by the following expression is of type TRUE/FALSE:
= Sales[TotalProductCost] > Sales[Amount]
The behavior of this data type is similar to the behavior of data types in Excel and it is
usually called a Boolean data type. Usually a column of this type is not made visible to
the end user, but is used internally for DAX calculations.
Having seen the importance of operators in determining the type of an expression, you can
now see a list of the operators available in DAX in Table 3-1.
Moreover, the logical operators are available also as DAX functions, with syntax very similar
to Excel syntax. For example, you can write
AND( [Country] = "USA", [Quantity] > 0 )
OR( [Country] = "USA", [Quantity] > 0 )
NOT( [Country] = "USA" )
that corresponds, respectively, to
[Country] = "USA" && [Quantity] > 0
[Country] = "USA" || [Quantity] > 0
!( [Country] = "USA" && [Quantity] )