Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

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
Top Solution Authors