Last Modified Date: 09 May 2017
AnswerThe attached example workbook uses the sample data set Superstore to demonstrate the following instructions:
- Create a calculated field with a name like Within 30 Days Filter and a calculation similar to the following:
DATEDIFF( 'day', LOOKUP( MIN( [Order Date] ), -1), MIN( [Order Date] ) ) <= 30
OR DATEDIFF( 'day', MIN( [Order Date] ), LOOKUP( MIN( [Order Date] ), 1 ) ) <= 30
- Drag [Customer Name] and [Order Date] to the Rows shelf
- Drag [Within 30 Days Filter] to the Filters shelf and click OK in the Filter dialog to close it.
- Right-click on [Within 30 Days Filter] on the Filters shelf and select Edit Table Calculation…
- In the Table Calculation dialog, do the following and then close the dialog:
- For Compute Using, select Specific Dimensions
- Ensure that both dimensions are checked. (They should be checked by default).
- For Restarting every, select Customer Name
- Right-click on [Within 30 Days Filter] on the Filters shelf and select Edit Filter...
- In the Filter dialog, check only True and click OK
Results of table calculations depend heavily on how the view is built, and may need to be adjusted if fields are added or removed from the view. For more information about how table calculations are computed and how to modify them, see Addressing and Partitioning.