04-25-2018 05:19 AM
I have been using WeekNumber('Date Curing (Shift)'n) function to extract the Week number from the Date. The default format is Numeric and I want to have it in Date or Time Format as I am using this as a category in Bar Chart and I want to see the order of the dates.
For eg : If I select the dates from 15 DEC 2017 - 15 JAN 2018 It should display the WEEK NUMBER 51 52 01 02 in this order but due to its Numeric Data Type it is showing in the order 01 02 51 52 .
is there any way to change the format or any other calculation?
04-25-2018 05:51 AM
A week number is not a date or a time. A date is number of days since the cuttoff point, time is number of seconds since 00:00.
Week number alone is not sufficient information to present data across years. Year at minimum is required. Therefore you need to check the requirements of the output, and suggest that week be used in conjunction with year to present data accurately, otherwise is week 1 the first week of 2017 or 2018? You know that as you have the year the reviewer does not. I would suggest putting the date into Year-Week format, then displaying that.
04-26-2018 03:55 AM
I think there is no default format for YEAR-WEEK as well.
I have added a drop down for YEAR along with the weeks. Its working fine now.
Thank you for your suggestion.
04-30-2018 11:42 AM
I have also used the approach of tracking the WeekNumber values by using a Year value dropdown list. The drawback is that you cannot then visualize across the calendar year boundaries. Since the customer really wanted to see a date (and not a week number) I found it easy to just choose a date value for each week (Saturday date value in my case) then use that date to represent the week in question. It works well and I actually compute it directly from the date values using the intnx function, in SAS code in the source data processing step.
FYI for general use, the WeekNumber as calculated by the WeekNumber function can result in values of 00 or 53, depending on the year.
05-02-2018 10:47 AM
Exactly, it depends upon the customer how he wants to see the output and it should be relevant with the filters used. I have added date variable in a slider and then used weeks in a Bar chart to show the output.
Thanks for your Input @mskatymay