5 Replies Latest reply on Dec 10, 2013 4:00 AM by . Indumon

# percent of time taken against total

I have three measures; Event Start Time, Event End Time and Event Duration. I'm attempting to calculate the percentage of time taken to complete all events against the total time. Total time is calculated by MAX(Event End Time)-MIN(Event Start Time). As such, Whenever, I true to get Tableau to calculate the percentage I get the message that I can't use both aggregated and non-aggregate measures in a calculated field.

I'm kind of stumped. Other than extracting the data into Excel and doing the very simple calculation, before returning to Tableau I'm at a loss.

Any thoughts would be appreciated.

Ps. If this makes no sense please let me know.

Kind Regards

Dan

• ###### 1. Re: percent of time taken against total

Hi Daniel,

If you can attach a packaged workbook or sample data then you will get more precise answers for your problem.

Based on the above description I believe you have to use window_max. // Duration Calculated in hour

```Sum(EventDuration)/Datediff('hour',Window_Max(MIN(Event Start Time)),Window_Max(MAX(Event End Time)))

```

//MAX(Event End Time)-MIN(Event Start Time) will not give you the total duration if you place the events in the rows, It will return the each individual event duration. So you have to use Window_Max function.

-Indumon

• ###### 2. Re: Re: percent of time taken against total

Hi Indumon,

Thanks for the quick reply.

I've attached a sample workbook. With the attached sample I would expect the percentage to be approx 4%.

Regards

Dan

• ###### 3. Re: Re: Re: percent of time taken against total

Hi Dan,

Please find the attached file.

```Sum([Duration])/Datediff('second',Window_Min(min([Start Time])),Window_Max(max([Stop Time])))

``` -Indumon

• ###### 4. Re: Re: percent of time taken against total

Indumon,

You're a genius.

Very many thanks

Dan

• ###### 5. Re: percent of time taken against total

, Glad that solution has worked for you!