2 Replies Latest reply on Mar 26, 2013 8:17 AM by Greg Araujo

# calculating min value based off a date range

Hi there,

Based on a range of selected dates in my date range quick filter, I am trying to show the first value within the specified date range. In other words...

 report_type report_month net_sales new_net_sales actual 01-Jan-2013 \$100,000.00 \$99,000.00 actual 01-Feb-2013 \$150,000.00 \$147,000.00 actual 01-Mar-2013 \$200,000.00 \$147,000.00 actual 01-Apr-2013 \$225,000.00 \$224,000.00 forecast 01-Jan-2013 \$250,000.00 \$217,500.00 forecast 01-Feb-2013 \$300,000.00 \$247,000.00 forecast 01-Mar-2013 \$350,000.00 \$339,500.00 forecast 01-Apr-2013 \$200,000.00 \$189,000.00

If I select january through march, I would like to display the information as follows...

 actual forecast start_net_sales 100,000 250,000 net_sales 450,000 900,000 new_net_sales 393,000 804,000

i tried creating a formula that used ATTR :

iif (attr([report_month]) = window_min(min([report_month])), sum([net_sales]), 0)

but that did not seem to give me the desired results.

any help is appreciated.

thanks,

greg

• ###### 1. Re: calculating min value based off a date range

Greg--

Please find an answer attached. I have included comments in the Filter calculation so that you can follow what I have done to accomplish this.

Hope this helps,

Dan

1 of 1 people found this helpful
• ###### 2. Re: calculating min value based off a date range

Thanks Dan, this helps out a lot.

In addition to that, I was hoping to calculate the max value as well.

Using the logic from your attached tableau workbook I tried to create an indexed row that was set equal to the size() but when I applied the T/F filter it did not work. I think I understand why but now I'm stuck in a dead end (again).