Forum Discussion
dapperscavenger
Helper V
6 years agoConvert iso (wwyyyy) to date?
My report brings in the date format as ww.yyyy (e.g. 50.2019, 06.2020)
How can I convert this to a date format? (e.g. 09-12-2019, 05-02-2020)
Hi @dapperscavenger ,
Please create a calculated column as shown below to work on it.
Column = VAR year = RIGHT ( 'Table'[wwyyyy], 4 ) VAR weeknum = VALUE ( LEFT ( 'Table'[wwyyyy], 2 ) ) VAR datetable = CALENDAR ( DATE ( year, 1, 1 ), DATE ( year, 12, 31 ) ) RETURN MINX ( FILTER ( datetable, WEEKNUM ( [Date], 2 ) = weeknum ), [Date] )Pbix as an attachment.
4 Replies
- Greg_Deckler
Community Champion
Split your Date column in Power Query. You can use the DAX below:
Column = VAR __Calendar = ADDCOLUMNS( CALENDAR(DATE([Date.2],1,1),DATE([Date.2],12,31)), "Week", WEEKNUM([Date]) ) RETURN MINX(FILTER(__Calendar,[Week] = [Date.1]),[Date]) - amitchandak
Super User
Assuming this is a single value
new column var _minYear =date(year(mid([column],3,4))1,1) var _maxYear =date(year(right([column],4))1,1) return Week = ((_minYear +(-1*weekday(_minYear)+1)) +7*left([column],2)) & "," & ((_maxYear +(-1*weekday(_maxYear)+1)) +7*mid([column],10,2)) - v-frfei-msft
Community Support
Hi @dapperscavenger ,
Please create a calculated column as shown below to work on it.
Column = VAR year = RIGHT ( 'Table'[wwyyyy], 4 ) VAR weeknum = VALUE ( LEFT ( 'Table'[wwyyyy], 2 ) ) VAR datetable = CALENDAR ( DATE ( year, 1, 1 ), DATE ( year, 12, 31 ) ) RETURN MINX ( FILTER ( datetable, WEEKNUM ( [Date], 2 ) = weeknum ), [Date] )Pbix as an attachment.
- dapperscavenger
Helper V
Thank you. That worked nicely!