Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
flemingg62
Helper I
Helper I

Return weeks as 1,2,3 from weeks in middle of a year

Hi

I have produced a data set by week and it returns (in tis example, but varies) 47,48 & 79 

 

flemingg62_0-1668449864563.png

looking to create a measure to return the first week from a date

I created a column to return the Week Number

Week = WEEKNUM([TimeStart]) and it returns 47,48, 49 etc

Now I want it to show 1,2,3 etc so I looking at something like

Week = WEEKNUM([TimeStart]) -Measure to calculate first week +1

 

Or any better way.

 

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @flemingg62 ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1668477221014.png

If you want  a calculated column:

Column = RANKX('Table',WEEKNUM([TimeStart]),,ASC,Dense)

Output:

vjianbolimsft_1-1668477266389.png

If you need a measure:

Measure = RANKX(ALL('Table'),WEEKNUM([TimeStart]),WEEKNUM(MAX('Table'[TimeStart])),ASC,Dense)

Output:

vjianbolimsft_2-1668477693794.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @flemingg62 ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1668477221014.png

If you want  a calculated column:

Column = RANKX('Table',WEEKNUM([TimeStart]),,ASC,Dense)

Output:

vjianbolimsft_1-1668477266389.png

If you need a measure:

Measure = RANKX(ALL('Table'),WEEKNUM([TimeStart]),WEEKNUM(MAX('Table'[TimeStart])),ASC,Dense)

Output:

vjianbolimsft_2-1668477693794.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Not quite, but  it help me solve it , Thanks

Week = WEEKNUM([TimeStart])-WEEKNUM(MIN(BI_Slots[TimeStart]))+1
amitchandak
Super User
Super User

@flemingg62 , refer if these columns can help

 

Start Month = eomonth([Date],-1)+0
Start of Week = [Date] -WEEKDAY([Date],2)+1 //monday
Month Start week = [Start Month] -WEEKDAY([Start Month ],2)+1 //monday
Month Week = QUOTIENT(DATEDIFF([Month Start week],[Date],DAY),7)+1

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors