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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
snemilipuri
Helper I
Helper I

Weekstart of the year - From Tuesday of Jan ending or Tuesday of Feb starting

Hi, 

 

According to the image below, the year 2022 starts on Jan 31, 2021. But our requirement is to start the year on the first tuesday of the year. 

I need another column, which shows the weeknumbers. Can anyone please help.

 

For ex: Jan 31, 2021  is  week 52, 2021

           Feb 1, 2021    is  week 52, 2021 

           Feb 2, 2021    is  week 1, 2022 

           Feb 3, 2021    is  week 1, 2022 

           Feb 4, 2021    is  week 1, 2022 

           Feb 5, 2021     is  week 1, 2022 

           Feb 6, 2021    is  week 1, 2022 

           Feb 7, 2021     is  week 1, 2022 

           Feb 8, 2021      is  week 1, 2022 

           Feb 9, 2021      is  week 2, 2022 

 

 

snemilipuri_1-1628580280657.png

 

 

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @snemilipuri

 

Create two calculated columns as:

FISCAL_YEAR = 
IF(
    'Table'[FISCAL_DATE]<MINX(FILTER('Table',WEEKDAY('Table'[FISCAL_DATE])=2),'Table'[FISCAL_DATE]),
    2021,
    2022
)
Weeknum = 
var _fiscal_start=MINX(FILTER('Table',WEEKDAY('Table'[FISCAL_DATE])=2),'Table'[FISCAL_DATE])
var _weeknum=
IF(
    'Table'[FISCAL_DATE]>=_fiscal_start,
    INT(('Table'[FISCAL_DATE]-_fiscal_start)/7)+1,
    51-INT(('Table'[FISCAL_DATE]-_fiscal_start)/7)
)
return 
CONCATENATE(CONCATENATE(CONCATENATE("week",_weeknum),","),'Table'[FISCAL_YEAR])

Here is the output:

vxulinmstf_0-1628749162626.png

The pbix is attached, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @snemilipuri

 

Create two calculated columns as:

FISCAL_YEAR = 
IF(
    'Table'[FISCAL_DATE]<MINX(FILTER('Table',WEEKDAY('Table'[FISCAL_DATE])=2),'Table'[FISCAL_DATE]),
    2021,
    2022
)
Weeknum = 
var _fiscal_start=MINX(FILTER('Table',WEEKDAY('Table'[FISCAL_DATE])=2),'Table'[FISCAL_DATE])
var _weeknum=
IF(
    'Table'[FISCAL_DATE]>=_fiscal_start,
    INT(('Table'[FISCAL_DATE]-_fiscal_start)/7)+1,
    51-INT(('Table'[FISCAL_DATE]-_fiscal_start)/7)
)
return 
CONCATENATE(CONCATENATE(CONCATENATE("week",_weeknum),","),'Table'[FISCAL_YEAR])

Here is the output:

vxulinmstf_0-1628749162626.png

The pbix is attached, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

snemilipuri
Helper I
Helper I

@amitchandak Please help

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.