Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

calculate number of days and convert into string

Raj_007
8 - Asteroid

Hi, Thanks for your time,

I have a field in SQL server with datatype as nvarchar(255)...and it includes the dates in MM/DD/YYYY format...

I need to calculate the number of days and convert it into string so that in the same column i can have Gap when there is no date value and a number when there is a date in it...

 

If([SignoffDate] = 'Gap', 'No-Data', [SignoffDate]+365 -today()   )   as SignOffForecast  (Minus today() we dont need to consider the timepart

once the number of days are caclulated convert to string so that it can have No-Data or the number of days

 

7 REPLIES 7
Qiu
21 - Polaris
21 - Polaris

@Raj_007 
Not 100% sure about the your formula part, but I am sure you can get some hints.

0215-Raj_007.PNG

Raj_007
8 - Asteroid

Hi Qiu,

Thank you so much, for some reason i am getting this error (attached)

 

the calculation should be SignoffDate + 365 - today()  = we should 365 days to the signoffdate then take out today from the calculation

thank you so much

 

Raj_007
8 - Asteroid

Hi,

could someone help.. i need to calculate the number of days from the datevalue then convert into string so that i can have the string value like "No Data"

when i try to open the file provided by Qui.. it gives me an error

 

RolandSchubert
16 - Nebula
16 - Nebula

Hi @Raj_007 ,

 

you could use a Formula tool:

 

2021-02-18_13-18-39.jpg

 

Within the formula you can use a condition, if conversion should be done.

 

Let me know if it works for you.

 

Best,

 

Roland

pedrodrfaria
13 - Pulsar

Hi @Raj_007 

 

What error are you getting? I saw that you were able to open the workflow @Qiu sent. 

 

I believe the function is doing what you asked. SignoffDate + 365 - today(), in this case is doing SignoffDate - today + 365. Which is the same thing.

 

DateTimeDiff([SignoffDate_Out],DateTimeToday(),"Days")+365 

 

Is this not what you are looking for?

 

Pedro.

 

 

 

 

Raj_007
8 - Asteroid

Thank you so much pedrodfaria - i was getting conversion error - but the solution provided by Roland works very well

thanks a lot - really appreciate your time - 

Raj_007
8 - Asteroid

Hi Roland, thank you so much...so the input format is the key here and converting it into string... really ..appreciate your time

Labels