4 Replies Latest reply on Jan 19, 2017 8:32 PM by Evgenia Stancheva

# Calculate days to reach a target

Hi Everybody,

In the attached sample, I would like to show the number of days that it took to reach the first \$1000 of sales, then the number of days to reach the 2nd \$1000 of sales, 3rd \$1000 etc.

I would like to find out if the speed at which we are making \$1000 of sales is getting faster or slower.

I suspect it might require a separate calculated field for each bucket ie. First \$1000, 2nd \$1000 etc.

Can anybody help me achieve this in Tableau?

Many thanks,

Matt

• ###### 1. Re: Calculate days to reach a target

Hi Matthew,

Find my approach as reference below and stored in attached workbook version

• ###### 2. Re: Calculate days to reach a target

Thanks - thats a great help. Do you know how to calculate the number of days between the lines?

Cheers,

MAtt

• ###### 3. Re: Calculate days to reach a target

Hi Matthew,

Hmmm stumbled around for a while but "can't bring the finger behind the trigger"

Based on if [Sales cumm.]>=1000 then attr([Date]) END I can find the first date above 1000 but can't capture it to calculate further with.....

Shinichiro Murakami could you step in and guide on this challenge?

Your assistance is appreciated.

• ###### 4. Re: Calculate days to reach a target

Hi Matthew,

We already solved this challenge offline, but I'm posting the solution here so that other people can benefit from it (solution workbook is attached).

First, you have to create 3 parameters that serve as benchmarks and allow for dynamic input from the user (you can change the values by typing in).

Then, we have to create 3 tests that check whether the running sum of sales has reached the respective benchmark.

After that, you have to calculate the dates when the benchmark was reached (see Date Test and Date Benchmark calculations).

Lastly, using a datediff calculation you can find the exact number of days.

Please flag this post as answered. Thanks!

Cheers,

Evgenia