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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Dayna
Helper V
Helper V

Current weeknumber showing incorrectly (i.e. next week)

Hello,

 

I have a very simple measure to get the current week number, as below:

Today (Week) = FORMAT(TODAY(), "YYYY/WW")
 
Today, being May 19th, belongs to week 20 in the calendar. However, this measure returns 2022-21.
Does anyone have any ideas why this is the case or how I can change it so it accurately reflects the current week, please?
 
Many thanks,
Dayna
2 ACCEPTED SOLUTIONS
ribisht17
Super User
Super User

@Dayna 

You have a point here,

 

ribisht17_0-1652970129146.png

 

This is taking the 1st of Jan as the first week, 

So, I need to go back by 1 week with the below probably 🙂

Today (Week) = FORMAT(TODAY()-7, "YYYY/WW")
 
ribisht17_1-1652970216556.png

 

 
Regards,
Ritesh

View solution in original post

Samarth_18
Community Champion
Community Champion

Hi @Dayna , Its calculating week number based on ISO 8601.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

5 REPLIES 5
Dayna
Helper V
Helper V

Thank you all!

Samarth_18
Community Champion
Community Champion

Hi @Dayna ,

 

Please try this:-

 

Today (Week) = FORMAT(TODAY(), "YYYY/"&weeknum(today(),21))

Output:-

Samarth_18_0-1652970189475.png

 

 

 

BR,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi @Samarth_18 that works, but can you explain what the ,21 is doing, please?

Samarth_18
Community Champion
Community Champion

Hi @Dayna , Its calculating week number based on ISO 8601.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

ribisht17
Super User
Super User

@Dayna 

You have a point here,

 

ribisht17_0-1652970129146.png

 

This is taking the 1st of Jan as the first week, 

So, I need to go back by 1 week with the below probably 🙂

Today (Week) = FORMAT(TODAY()-7, "YYYY/WW")
 
ribisht17_1-1652970216556.png

 

 
Regards,
Ritesh

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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