3 Replies Latest reply on Aug 22, 2016 1:12 PM by Mike Burke

# Conditional Date Filters in a single graph

I have two columns. one is last date of month and the other is total number of orders until that month.

 End_of_month orders_count 10/31/2014 20 12/31/2014 30 7/31/2015 40 10/31/2015 50 12/31/2015 60 4/30/2016 70 5/31/2016 80 7/31/2016 90 8/30/2016 99

I want to show this in a graph with year vs orders_count

The conditions are

IF (Year(End_of_month) < Year(Today)) then show the orders_count for december alone

else if  (Year(End_of_month) = Year(Today)) then show the orders_count for the lastest month.

Can someone help me with this ?

• ###### 1. Re: Conditional Date Filters in a single graph

I am thinking there is an easier way to do this.  You can change the aggregation of a measure by right clicking on the measure > Default Properties > Aggregation.  Choose Maximum and when you plot the years it will only show the maximum order count for that year.  Since it's cumulative this should work.  The other option would be to do the calculation in your data source or finally you could do it in Tableau.  The attached might help.  Best of luck,

Mike

• ###### 2. Re: Conditional Date Filters in a single graph

Thanks Mike for your timely reply.! ... But I wanted the solution to be more generic. Is there anyway to get it done without hardcoding the exact date in the calculated fields ? (Becoz, I may have endofmonth starting from 01/31/1988.. In this case, I may then end up having more  calculated fields)

• ###### 3. Re: Conditional Date Filters in a single graph

Changing the default aggregation of the measure to max solve this.  The alternative was to create those calculated fields, which I agree is optimal and not necessary. I probably should have left that alone to keep things straight forward.

Let me know if changing the aggregation to Maximum doesn't work.

1 of 1 people found this helpful