ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

IF Statement Malformation: Type Mismatch where Number Required

stennis
Météoroïde

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 RÉPONSES 11
DavidP
17 - Castor
17 - Castor

This is how I would do it.

 

DavidP_0-1594248696292.png

 

stennis
Météoroïde

@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!

Étiquettes
Auteurs des meilleures solutions