Microsoft Office Tutorials and References
In Depth Information
It is not yet time to fully discuss the date dimension; we get to that in Chapter 7, “Date
Calculations in DAX.” Nevertheless, it is worth pointing out here a very important concept,
for which the date dimension serves as a perfect example.
In the previous example, you loaded a dimension called DimTime, which contains all the
details about date and time. In Figure 4-30, you can see the PivotTable field selector with
the time dimension expanded. You can appreciate that the time dimension contains several
useful attributes that can be used to slice your data.
FIguRE 4-30 The attributes of the time dimension.
In Chapters 2 and 3, you learned that these attributes can be computed directly in the
SalesOrderHeader table using the several date and time functions available in DAX. You are
now going to learn a different approach to the handling of time attributes, and in general, of
aggregators. In fact, in this model, you now have a time dimension with attributes and a
relationship between orders and the time dimension. Guess what is changing? The data model.
If you have an entity (in this case the date) for which there are many interesting attributes
that you could use to slice data (in the case of the date, you have year, month, day in the
year, and so on) you have two options:
■ You can add attributes to the original table, as we have done in Chapter 2. This
technique is easy to implement. Whenever you want a new attribute, you simply define a
computed column in the table holding that attribute. Nevertheless, if you have—for
example—many date columns in your database, you need to define many calculated
columns, one for each table containing a date column.