Filtering using parameters can be an efficient way of letting your user control what they see, especially if a single parameter is used to filter multiple views. Parameters can also be used to create custom filters not usually available in the "filter" shelf. Here I'm going to show you an example of this: a "number of years in view" filter created using a parameter. This example is from Workout Wednesday 2021, Week 3.
This is our starting point, with all available years in the view. First we'll create our parameter, an integer with a range of 1-10:
We'll then need a calculated field that does two things: find the maximum year in the view and subtract the current parameter value from it. The result of this calculation will be the latest year that should NOT be shown in the view. For example, if our parameter is set to 3, the view should show the 3 most recent years, 2018, 2019 and 2020. Our calculated field will be 2020 - 3 = 2017, the latest year NOT shown. This is what the calculation should look like:
The level of detail calculation returns the maximum year in the view, and the parameter value is subtracted from it. Now all that is left to do is to create a calculated field to actually filter the years:
This is simply a Boolean field. It will return "True" for the years greater than the value of our last calculation. Just drag this to the filter shelf, show only "True" values, and we're done!