Database Reference
In-Depth Information
3. Specify the
FullAlternateDateKey
column as the
Date
column.
4. Now you can use the newly defined date table in your calculations.
5. To create a previous year's sales calculation, click on the
FactInternetSales
table.
6. Click on any of the cells in the
Measure Grid
and add the following calcula-
tion:
Previous Year
SalesAmount:=CALCULATE(sum([SalesAmount]),
PREVIOUSYEAR(DimDate[FullDateAlternateKey]))
7. Change the value of the
Format
option of the measure in the
Properties
window to
Currency
.
8. Deploy your model to the server.
The
CALCULATE
command is one of the most powerful commands available in DAX;
it allows you to specify calculations that use filters. In the previous example, it cre-
ates a sum of the sales amount but filters the calculation using the results of the
PREVIOUSYEAR
command.
Note
There are several other filter functions available that can be used to create ad-
vanced calculations in DAX; for a reference of them, refer to the online manual
Search WWH ::
Custom Search