4 Replies Latest reply on Jun 18, 2013 9:00 AM by Emily Mueller

# Dynamic event as axis

Hello, I'm not sure exactly how to explain this, but I'm looking for a way to have an event as the axis.  Thanks to Joe Mako for help on this project previously here: Calculate time between shifts. Now I want to show who is over a certain number of hours since their hours have been "Reset" by having over 34 hours off.  I have the sum of shift lengths as a filter, but for some it is showing their previous sum of shifts as well.  I want to show only the most recent sum of shifts since their "Reset". Does anyone know if this is possible?

Thanks in advance for any help on this!

Emily

• ###### 1. Re: Dynamic event as axis

How about a calc field like:

IF LAST()==0 THEN

[Running sum shift length]

END

with compute using set to "eventdate"

Then you can apply your filter to this pill as well.

• ###### 2. Re: Dynamic event as axis

Thanks Joe, that worked well.  I've seen formulas using First() and Last() and ==, can you explain to me what this is doing?

Thanks

Emily

• ###### 3. Re: Dynamic event as axis

== is the same as = in Tableau, so [Value]=1 is the same as [Value]==1.

FIRST() returns the distance to the first mark in the partition, so FIRST()==0 will be True for the first mark in the partition. FIRST() will return 0 and negative numbers, because the distance to the first mark from any subsequent mark will be a negative distance.

LAST() returns the distance to the last mark in the partition, so LAST()==0 will be True for the last mark in the partition. LAST() will return 0 and positive numbers, because the distance to the last mark from any previous mark will be a positive distance.

I think of it like a number line, where 0 is the current mark.

These functions are very useful in many situations, because it is quite common to want to reference the first or last mark in a partition.

I think a great way to learn about them is to try them out

1 of 1 people found this helpful
• ###### 4. Re: Dynamic event as axis

Thanks Joe!