Kapil Lehar
Kapil Lehar

Reputation: 81

Need to display monthly data excluding 2 months of data

Im trying to design a dashboard wherein I need a parameter to control 2 things. If I select "Rolling 12", I should be able to see the last 12 months of my data with respect to current month. When I select "Rolling 12-2", I should be able to see

last 12 months of my data but excluding the latest 2 months. E.g If I'm in January 2018 then I should be able to see data excluding Jan 18 and Dec 17 (from Jan 17 to Nov 17). I have tried some techniques but without success. Can anyone help. Thanks.

Reference Tableau Workbook attached at link :

Upvotes: 0

Views: 413

Answers (1)

Bernardo
Bernardo

Reputation: 3318

Using the Superstore sample data (I don't have 10.5 installed), I created the following boolean expression which you'd put in the filter shelf for True.

Give a parameter called rolling, create calc field as follows:

if [rolling] = 'Rolling 12' 
then DATEDIFF('month',[Order Date],{max([Order Date])}) < 12
ELSEIF [rolling] = 'Rolling 12-2' 
then DATEDIFF('month',[Order Date],{max([Order Date])}) < 12
and DATEDIFF('month',[Order Date],{max([Order Date])}) >= 2
end

Adjust the date name for your date field.

Upvotes: 1

Related Questions