5 Replies Latest reply on Dec 3, 2014 8:01 PM by Chris McClellan

# Calculations & possible if statements.

Hi,

A bit of background: The data the I have in tableau is a calculation maintenance dates based on KM based assets. The maintenance requirements changes at varying service intervals, for example, minor exam 150k, exam 450k, major 900k. Obviously these exams overlap and when they do the greater exam is preformed.

My question is, if the asset is showing both a 450k exam due and a 900k exam due on the same date (or say within 1 month or 2 of each other), how do  a preform a calculation to say that if there is 2 exams due at once, to preform the exam with the highest service interval?

Jess

*Sample data and workbook attached

• ###### 1. Re: Calculations & possible if statements.

Hi Jessica,

I'm not sure I'm understanding your question or visualization correctly. One thing that would be very helpful would be if you attach a packaged workbook with your data so community users can see the visualization you are working with and try and help you out.

Here's a quick tutorial on how to attach a packaged workbook, if you need it: Attaching a Packaged Workbook

After that, we'll see what we can do!

--Ben

• ###### 2. Re: Calculations & possible if statements.

Do you have any sample data ? (even just randomised in Excel for a single asset ?)

I think this should be possible with order your IF logic the right way, but it would be better to see some data - at minimum you'd need a table showing the KM of the asset over time, and another table showing the exams, and how often they re-occur, and then simply structure your IF to test for the most important test first, then ELSEIFs to get you down to the least important one last.

• ###### 3. Re: Calculations & possible if statements.

Thanks Ben & Chris, attached now to original post.

• ###### 4. Re: Calculations & possible if statements.

I think this is the answer you're after:

- Create a new sheet

- Put EQUIPNO on the Row Shelf

- Put APPROX DUE DATE on the Columns Shelf and change to Day format

- Change the sheet to a Text Table

- Put WONOPM on the Text mark

- Change WONOPM to a Measure > Maximum aggregation

I also created an expression called Service with this formula:

if count([WONOPM]) > 1 then

"multiple"

else

Attr([WONOPM])

end

and put that on the Color mark, but I couldn't figure out how to use the "multiple" to my advantage and report on it more.

• ###### 5. Re: Calculations & possible if statements.

Nice to see another Aussie on the forum as well