Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

IF Statement Malformation: Type Mismatch where Number Required

stennis
6 - Meteoroid

I'm trying to show how long an outage lasted with the following statement. my boss wants to see the outcome as '1 day(s) 2 hour(s) 36 minute(s)'

 

The formula accepts everything until I add the Endif. then I get the malformed statement error in the subject. Thoughts?

 

 

'' IF Average([Outage Duration (Seconds)]) < 3600
THEN
//Convert from Seconds to Minutes
"0 Day(s) 0 Hour(s) " + ToString(ToNumber(Average([Outage Duration (seconds)])/60)) + " Minute(s) "

ELSEIF Average([Outage Duration (seconds)]) < 86400
THEN
//Convert from Seconds to Hours
"0 Day(s) " + ToString(ToNumber(Average([Outage Duration (seconds)])/3600)) + " Hour(s) " + ToString(ToNumber(Average([Outage Duration (seconds)])/3600)/60) + " Minute(s)"

ELSE
//Convert from Seconds to Days
ToString(ToNumber(Average([Outage Duration (seconds)]) / 86400)) + 'Day(s)' + ToString(ToNumber(Average([Outage Duration (seconds)]) / 86400) / 3600) + "Hour(s) "+ ToString((ToNumber(Average([Outage Duration (seconds)]) /86400) / 3600) / 60) + "Minute(s)"

endif  "

 

Thanks for the help! 

11 REPLIES 11
DavidP
17 - Castor
17 - Castor

This is how I would do it.

 

DavidP_0-1594248696292.png

 

stennis
6 - Meteoroid

@DavidP wrote:

This is how I would do it.

 

DavidP_0-1594248696292.png

 


I made it way more complicated than necessary! Thank you so much!

Labels