Have you thought about grouping the Sales into years first?
May make your live a lot easier
Something like this -
IF YEAR([date field]) = 2015 THEN [sales] ELSE NULL END
IF YEAR([date field]) = 2016 THEN [sales] ELSE NULL END
Then base your ranking/ parameter (whichever) on the new annual sales field instead of the original 'total' sales
That doesn't seem to work as it doesn't take into account other filters I have on my data.
If i filter my data on a specific country and filter on my dimension based on the 2016 sales, top X, it doesn't seem ot be respecting that there's a country filter in place.
2 of 2 people found this helpful
You should read Tableau's Order of Operations
Then have a look at which of your filters you want to "Add to Context", this should help you achieve what you are looking for.
As Chris suggests - that is a useful document.
It very much depends on your data and setup.
You maybe able to use TOTAL, or LoD (to circumvent the filters)
But it does depend on the 'context'
Examples demonstrating the problem are always appreciated
Otherwise its only general guess work.
Thanks for mentioning context filters. That seems to just what I was looking for.
One other issue though in the calculate field for 2016. I am using a calculated field which is determined by a parameter (essentially letting you choose what measure you want the chart to display).
If I want to use this calculated field instead of Sales, thenI cannot use the formula you specified above due to aggregation. I wrapped [Year] in ATTR but I still cannot select the 2016 Sales field as the basis of my ranking.
sorry not been on in a few days, what you need to do is create the calculated field that chooses the measure based on your parameter then replace [Sales] with that field in the above calculations.
That should do it, but if not, can you attach a workbook for us to look at?