Forum Discussion
RvdHeijden
Post Prodigy
9 years agoTransform a date to year-month
I have a question and i need your help. I have a column with dates in the following format 3-2-2017 07:49:00 and i want to transform that to a year-weeknumber for example 2017-05. My formula ...
- 9 years ago
- 9 years ago
RvdHeijdenHere's DAX
Year-Wk = YEAR ( 'Calendar'[Date] ) & "-" & CONCATENATE ( IF ( WEEKNUM ( 'Calendar'[Date] ) < 10, "0", "" ), WEEKNUM ( 'Calendar'[Date] ) )Yes you may have to adjust WEEKNUM depending on when your week starts SUN (1) on MON (2)
I have skipped this optional parameter because the default is 1 which is what i need.
Hope this helps.
Good Luck!:smileyhappy:
Sean
Community Champion
9 years agoRvdHeijdenHere's DAX
Year-Wk =
YEAR ( 'Calendar'[Date] ) & "-"
& CONCATENATE (
IF ( WEEKNUM ( 'Calendar'[Date] ) < 10, "0", "" ),
WEEKNUM ( 'Calendar'[Date] )
)
Yes you may have to adjust WEEKNUM depending on when your week starts SUN (1) on MON (2)
I have skipped this optional parameter because the default is 1 which is what i need.
Hope this helps.
Good Luck!:smileyhappy:
RvdHeijden
Post Prodigy
9 years agoi want the week to start on a monday so where should i place this variable in the formula ?
Year-Wk = YEAR ( 'Calendar'[Date] ) & "-" & CONCATENATE ( IF ( WEEKNUM ( 'Calendar'[Date] ) < 10, "0", "" ), WEEKNUM ( 'Calendar'[Date] ) )