Forum Discussion
GadeshevArman
3 years agoNew Member
Change week & year format
Hello everyone, I have a column with date and created costum column to get week and year based on that date. OrderWeekYear = IF(WEEKNUM(WorkOrder[Order Date)<10,FORMAT([Order Date],"YYYY-0WW"),...
- Anonymous3 years ago
Hi GadeshevArman ,
In the WEEKNUM() function, if there is no return type mentioned by default the week containing 1st Jan is considered as week 1.
You can refer to this -
https://learn.microsoft.com/en-us/dax/weeknum-function-dax
This will give you desired result -
OrderWeekYear =var _week = WEEKNUM('Date Table'[Date],21)returnIF(_week<10,year('Date Table'[Date])&"-0"&'Date Table'[Column],YEAR('Date Table'[Date])&"-"&'Date Table'[Column])
Anonymous
3 years agoNot applicable
Hi GadeshevArman ,
In the WEEKNUM() function, if there is no return type mentioned by default the week containing 1st Jan is considered as week 1.
You can refer to this -
https://learn.microsoft.com/en-us/dax/weeknum-function-dax
This will give you desired result -
OrderWeekYear =
var _week = WEEKNUM('Date Table'[Date],21)
return
IF(_week<10,year('Date Table'[Date])&"-0"&'Date Table'[Column],YEAR('Date Table'[Date])&"-"&'Date Table'[Column])