Categories
- All Categories
- 135 Oracle Analytics News
- 24 Oracle Analytics Videos
- 14.6K Oracle Analytics Forums
- 5.6K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 51 Oracle Analytics Trainings
- 9 Oracle Analytics Data Visualizations Challenge
- 4 Oracle Analytics Career
- 3 Oracle Analytics Industry
- Find Partners
- For Partners
Format date YYYY - WW

Hello,
I need your help, i can't find anywhere a solution to my problem.
I use OBIEE 12.2.1.0 for create dashboard.
I have a date on this format : "DD/MM/YYYY" and I try to have this format : "YYYY - WW"
WW = WEEK_OF_YEAR
I try to have this transformation in "Edit formula" in my columms selected when I create a rapport (fx).
I hope someone could help me
Thank you in advance for watching my message!
Answers
-
cast(year(current_date) as char(4))||' - ' ||cast(week_of_year(current_date) as char(2))
replace current_date with your date column
0 -
Thank you very much for your answer !! And it works !!
Now I have another problem, some dates appear: 2017-1 instead of 2017-01 how to get around the problem?
I would like to present these dates in a diagram in chronological order and without the '0' it distorts everything.
Thank you again for your answer !
0 -
add ||case when week_of_year(current_date)<10 then '0' end||
0 -
cast(year(current_date) as char(4))||' - ' ||CASE WHEN LENGTH(cast(week_of_year(current_date) as char)) =1 THEN '0'||cast(week_of_year(current_date) as char(1)) ELSE cast(week_of_year(current_date) as char(2)) END
If correct, mark the answer as correct for other users of the forum.
0 -
+1 to the answers given.
Next time have a properly formed date/calendar dimension and you won't ever have to do this formula again.
0 -
Perfect !!!!! Thank you very much for your help!!!!
Here is the final solution in case other people have the same problem:
CAST (YEAR(current_date) as char(4)) || case when WEEK_OF_YEAR(current_date) < 10 THEN '-0' ELSE '-' END || CAST (WEEK_OF_YEAR(current_date) as char(2))
0