In this example, we will create some measures such as year-to-date, quarter-to-date, fiscal year-to-date, and running total, in order to show you how to use DAX functions and create expressions as you wish. As part of this example, we will use the CALCULATE
function, which calculates an expression on a filter context. So, perform the following steps that show the use of time intelligence functions:
Go to Grid View of the InternetSales table and add a new measure using the following expression, and change the format string of this measure to
Currency
:Sales Amount YTD:=TOTALYTD(SUM(InternetSales[SalesAmount]),'Date'[FullDateAlternateKey])
Save the changes and analyze the model in Excel. Select Calendar under Date, and Sales Amount YTD and Sum of SalesAmount under measures. You will see that the new measure is shown but it is not correct (look at the next screenshot). The problem is that the YTD is not calculated correctly; it is because...