cancel
Showing results for
Did you mean:
Member

## Convert date into YEAR-Week

I need to change this formula so that the format will be YYYY-WW

THis formula works but the result is 201801 or 201802 so without the '-' between Year and Week

How do i change this formula ?

Week Number =
INT (
CONCATENATE (
YEAR ( 'Date'[Date] );
CONCATENATE (
IF ( WEEKNUM ( 'Date'[Date] ) < 10; "0"; "" );
WEEKNUM ( 'Date'[Date] )
)
)
)
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: Convert date into YEAR-Week

Create a caluclated column

`Column = IF(WEEKNUM([Date])<10,FORMAT([Date],"YYYY-0WW"),FORMAT([Date],"YYYY-WW"))`
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 REPLIES 5
Highlighted
Super User III

## Re: Convert date into YEAR-Week

But it won't be a number of course:

```Week Number =
CONCATENATE (
YEAR ( 'Date'[Date] );
"-"
& CONCATENATE (
IF ( WEEKNUM ( 'Date'[Date] ) < 10; "0"; "" );
WEEKNUM ( 'Date'[Date] )
)
)```

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers

Member

## Re: Convert date into YEAR-Week

@AlB then how do i fix the issue ?

Ive altered the formula but, like you said, it returned an error that it can't convert type Tekst to Number.

Week Number =
INT (
CONCATENATE (
YEAR ( 'Date'[Date] );"-" &
CONCATENATE (
IF ( WEEKNUM ( 'Date'[Date] ) < 10; "0"; "" );
WEEKNUM ( 'Date'[Date] )
)
)
)
Member

## Re: Convert date into YEAR-Week

@AlB  any ideas ? a different formula is also ok

Community Support Team

## Re: Convert date into YEAR-Week

Create a caluclated column

`Column = IF(WEEKNUM([Date])<10,FORMAT([Date],"YYYY-0WW"),FORMAT([Date],"YYYY-WW"))`
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Member

## Re: Convert date into YEAR-Week

@v-juanli-msft that did the trick, thank you 🙂

Announcements