7 Replies Latest reply on Jul 2, 2018 9:52 AM by Shinichiro Murakami

# Date range identification

Hi, how can I create a calculated field that print based on dates conditions? Example

If DateX >= 30 days print (> 30 days)

If DateX between 15 to 29 days print (15-29 days)

If DateX between 5 to 14 days print (5-14 days)

If DateX between 0 to 4 days print (0-4 days)

Thanks!

• ###### 1. Re: Date range identification

HI Paco,

Could you please attach some sample data?

Twbx format is the best always.

Thanks,

Shin

• ###### 2. Re: Date range identification

Hi Paco Matt

Yes you can do it easily...as of i understood your query you want the formula. how to write it in tableau.

So plz refer below formula

IF

DateX <= 4 THEN '0-4 days'

ELSEIF

DateX >= 5

AND

Datex<=14 THEN '5-14 days'

ELSEIF

DateX >= 15

AND

Datex<=29 THEN '15-29 days'

ELSEIF

DateX >= 30 THEN '>30 days'

END

Thanks

Alok

• ###### 3. Re: Date range identification

Hi Murakami, thanks for your reply. Please find the sample date worksheet attached. I'll like to identify each date based on todays date difference.

• ###### 4. Re: Date range identification

Hi Sachan, I have some syntax error based on your formula.

• ###### 5. Re: Date range identification

HI Paco

Hope this helps.

If statement judges the criteria sequentially, and once the criteria hit, that field is assigned to that value and stop go thru judgement logic.

Meant,

if the value is 30, it is recognized as " >30" not go thru further judgement logic.

IF the value is 1

NO => then next => NO =>then next =>  NO =>  then next =>

hit with criteria of ">0' then assigned to "0-4 days"

Thanks,

Shin

• ###### 6. Re: Date range identification

Thanks a lot Murakami, this is exactly what I'm looking. Thanks also to all of those replying and collaborating.

Regards!

• ###### 7. Re: Date range identification

HI Paco

You are welcome.

Thanks,

Shin