Last Modified Date: 26 Feb 2018
- Select Analysis > Create Calculated Field
- Name the field YTD Sales, enter the following calculation, then click OK:
IF [Order Date] <= TODAY()
AND DATEDIFF('year',[Order Date],Today())= 0 THEN [Sales] END
- In the Measures pane, right-click the YTD Sales calculation and select Duplicate.
- Right-click YTD Sales (Copy), select Edit, and make the following changes, then click OK:
- Name the field MTD Sales
- Change 'year' to 'month'.
- Drag YTD Sales to Columns.
- Drag MTD Sales to the YTD Sales axis. When you see an icon with a double horizontal ruler, release the mouse button.
Option 2Sample data, such as Superstore, may not contain dates from this year. If there is no data from this year, the above calculations will display 0.
To replicate these instructions with sample data, substitute a parameter for TODAY():
Right-click in the Measures pane and select Create Parameter. Enter the following options, then click OK:
- Name: Today
- Data Type: Date
- Current Value: enter the most recent date in your data source
Additional InformationTo view these steps in action, see the video below.
Note: the video has no sound.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Training and Tutorials