web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Calculate week number,...
Power Apps
Answered

Calculate week number, weekday, month eg.

(0) ShareShare
ReportReport
Posted on by 144

Im using a model drive app.  In the Entity there is a data Field: Orderdate.   The order day today is 4.11.2020 (November, 4th - Norwegian format)

 

I like to add Fields With week number, day in week, day in week in text (Wednesday) and also month name. 

 

Orderdate: 4.11.2020

Week number: 45

Day in week: 3 (starts With 1 on monday)

Weekdayname: Wednesday

Monthname: November

 

Any idea how this values can be added to the actual Field based on "Order date"?

(It seems easy in Canvas app", but only model driven app is in use. 

 

 

I have the same question (0)
  • ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @TrulsB,

    Unfortunately on model driven apps those same formulas are not available. Creating a plugin would be a good option, using the Calendar class of the .NET framework. 

    Some useful references below:

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/tutorial-write-plug-in

    https://docs.microsoft.com/en-us/dotnet/api/system.globalization.calendar.getweekofyear?view=netframework-4.6.2

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

  • TrulsB Profile Picture
    144 on at

    Hi, thank you !

    Your suggestion seems be requiere knowledge in Visual Studio, C Programming eg.

    Do you have any other suggestions? Do you know of somwhere to download plug-ins for week and day calculation? Any experience using Power Automate to do this calculations and update when a record is changed ?

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @TrulsB :

    It can be inplemented with flow.I'v made a test for your reference:

    1.JPG

    Formula reference:

    Switch On:

    dayOfWeek(triggerOutputs()?['body/crba2_orderdate'])

    Day in week:

    dayOfWeek(triggerOutputs()?['body/crba2_orderdate'])

    Monthname:

    formatDateTime(triggerOutputs()?['body/crba2_orderdate'],'MMMM')

    Week number:

    add(div(dayOfYear(triggerOutputs()?['body/crba2_orderdate']), 7),1)

    Weekdayname:

    Variables('WeekName')

    2.JPG

    Best Regards,

    Bof

     

  • TrulsB Profile Picture
    144 on at

    Thanks, perfecet !!

  • TrulsB Profile Picture
    144 on at

    Just an additional question.  Everything Works well, but when i remove the date in the date Field in Model Drive app, and save - whe flow runs - but the Fields for Week number, days in week, weekday name eg is no cleared or reset. The values for the last date are still there, even if the date Field is empty.  Any idea how to handel this, so every Fields are empty of the Orderdate Field is empty. ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard