🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Function description

User: "Thiru"
New Altair Community Member
Updated by Jocelyn
dear all, 

Ive a data set in which age of the subject is given as an attribute and the values  are given in
either months  or years or  in weeks.  

eg:  3 days ,   8 weeks ,  10 months

I want to convert that attribute in to no. of days, so that i can group them based on no. of days.   I was trying
to use functions - 'finds" and "parse", but not successful.  can someone helps me on this. thank you.

regds
thiru

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "kayman"
    New Altair Community Member
    Accepted Answer
    Updated by kayman
    @Thiru, Now I get it :-)

    In this case use 'contains' is what you need, in combination with the if statement.
    So if Age pet contains year then get number times 365, else if Age pet contains month get number times 30 and so on.

    So something like this :

    if(contains([Age pet],"year"),
        parse(replaceAll([Age pet],"\\D",""))*365,
    if(contains([Age pet],"month"),
        parse(replaceAll([Age pet],"\\D",""))*30,
    if(contains([Age pet],"week"),
        parse(replaceAll([Age pet],"\\D",""))*7,
    parse(replaceAll([Age pet],"\\D","")))))