cancel
Showing results for
Did you mean:
Frequent Visitor

How to calculate week number?

Im creating a small booking app, where the users are used to Weeknumbers.

Is it posible to spesify like :

Week : 5

Result would be : 30/1-2017 - 5/2-2017

Or vice versa,

Spesify the date and then get the current weeknumber.

This allso has to adjust for leap year.

Best Regards

Raymond

40 REPLIES 40
Memorable Member

Thank you @Anonymous,

I was looking for this. I will try it tomorrow 🙂

hello,

i am french,i need a formula to calculate week number calendar European.

Best regards,

Audric.

Frequent Visitor

Thank you dionmills_argos it helped a lot !

Resolver II

This worked great after I replaced all the ";" and replaced them with ",". Also I replace the datapicker with today() to get today's weeknumber.

Anonymous
Not applicable

I've attached my solution for calculating the week number based off of Today().  All the examples looked like fun so I wanted to try my hand as well.  Only minor testing performed but it seems to work.  How it works is:

- Find the number of days between the current date and the first of the year using DateDiff

- Add the day of the week for the first of the year using "WeekDay"

- Divide by 7

- Round Up

RoundUp((DateDiff(DateValue(Concatenate("1/1/", Text(Year(Today())))), Today()) + Value(WeekDay(Concatenate("1/1/", Text(Year(Today())))))))/7,0)

Memorable Member

Hello DennisO,

Thank you for sharing.
I copy paste the expression but I receive an error. Are you sure it works? Can you copy paste what you have posted and try it, please?

Weekk number ISO:

RoundDown((RoundUp(selec.SelectedDate-Date(Year(selec.SelectedDate-Weekday(selec.SelectedDate-1)+4);1;3);0)+
Weekday(Date(Year(selec.SelectedDate-Weekday(selec.SelectedDate-1)+4);1;3))+5)
/7;0)

selec=datepicker or label

Spoiler
remove ; , if need
Frequent Visitor

Hi AUPowerapps,

It works perfectly ! Thank you !

Regular Visitor

I am trying to use this formula with a date picker and 1,1 as suggested by you and getting a -ve week value. . . For the first week on tear it is ok. . And in the second week it says "0" and after that -ve. can you please help.

Anonymous
Not applicable

This solution rocks. THX a 1000 times @AUPowerappps

Frank

Denmark

Announcements

Celebrating the May Super User of the Month: Laurens Martens

@LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!