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

Notifications

Announcements

Community site session details

Community site session details

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

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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard