Francisco Rademacher Posted March 25, 2022 Posted March 25, 2022 I am working in WebFocus Designer. We have a datetime variable represented as: 2022/08/02 01:23:42. For YOY and MONTH over MONTH comparisons, I need to separate those from the mentioned datetime. I need to break down all the output that occured in January, February, etc...only as those months. The same for Year, and MAYBE week if possible. What is the best and/or quickest way to do this I have tried some but to be frank, I am still learning...lol Edit: I have tried some COMPUTE functions to no avail. I am curious if it is the format the DATETIME is coming in as that keeps COMPUTE from working. I am obviously not sure though. Grouping or BINS do not work either as new data is constantly coming in.
David Beagan Posted March 26, 2022 Posted March 26, 2022 You could do the COMPUTE calculations as follows, although it might be more appropriate as DEFINE calculations. COMPUTE Year/I4 = HPART(Date,'YEAR','I2'); COMPUTE Month/I2 = HPART(Date,'MONTH','I2'); COMPUTE YearMonth/I6YYM = 100 * Year + Month;
Debra Waybright Posted April 29, 2022 Posted April 29, 2022 For a define, you can try using DTRUNC. I think that's the newer function for getting date parts. DEFINE DATE_M/YYMDm =DTRUNC(DATE_FIELD, MONTH);
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now