Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #312: Hours, Minutes and Seconds

chiomaisaiah
6 - Meteoroid
Spoiler
chiomaisaiah_0-1648752074430.png

 

NicoleJohnson
ACE Emeritus
ACE Emeritus

Solved two ways! The long way, and the "one tool solution" way. 😁

 

Spoiler
The long way uses some of the traditional parsing tools to split the time into 3 parts, filter out 0 time, and apply the Hours/Minutes/Seconds labels before concatenating back together.

The "one tool solution" way, on the other hand, uses some nested formulas to strip out the time components (as long as they are not 0), string them together, and then remove any extra/unnecessary spaces.

NicoleJohnson_0-1648757988904.png

Here's the one-tool formula I ended up using!

TrimLeft(
Replace(
If IsEmpty(TrimLeft(left([Chat Time],2),"0")) Then Null() Else TrimLeft(left([Chat Time],2),"0") + " Hours" Endif

+ " "
+ If IsEmpty(TrimLeft(Substring([Chat Time],3,2),"0")) Then Null() Else TrimLeft(Substring([Chat Time],3,2),"0") + " Minutes" Endif

+ " "
+ If IsEmpty(TrimLeft(Right([Chat Time],2),"0")) Then Null() Else TrimLeft(Right([Chat Time],2),"0") + " Seconds" Endif
," "," ")
)

Cheers!

NJ

MJ
8 - Asteroid

No need for that 2nd input of lookup values :)

Spoiler
MJ_Solution.png
Michael_Draper
7 - Meteor

Took a shot! Probably a better way to do it, but I 

Spoiler
converted string to number and back to string to get rid of leading zeros

 

Spoiler
Michael_Draper_1-1648766809512.png

 

Michael_Draper_0-1648766792637.png

 

G_Thompson
8 - Asteroid

Here's my answer!

VizChic
11 - Bolide

First time back in Alteryx for a while, so starting off slow :)

Pang_Hee_Choy
12 - Quasar

one formula tool, 

 

datetimeformat

regex_Replace to remove 00 and leading 0.

Spoiler
Pang_Hee_Choy_3-1648802827751.png

 

Pang_Hee_Choy_2-1648802770574.png

 


 

 

RolandSchubert
16 - Nebula
16 - Nebula
Spoiler
312.jpg
JereJussila
8 - Asteroid
Spoiler
JereJussila_1-1648814100025.png

 

Had to give it a go also with Regex, capture groups to the rescue

Powerhouse_21
9 - Comet
Spoiler
Powerhouse_21_0-1648824082847.png