Using the TOTALYTD function
The TOTALYTD
function is an additive measure that returns the total records from the beginning of the year to the date in the context. For example, you can use this function to calculate the total number of crashes from 1/1/2016 to the date that you selected in the filter context. You can quickly calculate the number of records at any point in the year.
How to do it...
- Open the Model.bim to the CRASH_DATA_T table.
- In the measure creation area, click on an empty cell to create a measure to return the year to date cumulative total for the number of crashes:
YTDTotals:=TOTALYTD( COUNT (CRASH_DATA_T[CASE_NUMBER]), Calc_Date_T[CRASH_DATE])
- Then press Enter to create the measure:
- Now deploy the solution to the server and switch to SQL Server Management Studio to view the results. Browse the model and select the YEAR, Month_Name, CRASH_DATE, Records, and YTDTotals:
- The results displayed in the YTDTotals measure are the number of records...