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 / Power Fx: Calculate We...
Power Apps
Unanswered

Power Fx: Calculate Weekday Hours

(0) ShareShare
ReportReport
Posted on by 4

Hi All,

 

I’m trying to add a column within my table (Dataverse) using formula which would work out the weekday hours. Unfornatley, it’s not liking the formula I’ve input giving me an error.

 

Error: Invalid argument type (Decimal). Expecting a Enum (StartOfWeek) value instead.

Formula: If(Or(Weekday('Start Time',2)<>6,Weekday('Start Time',2)<>7),DateDiff('Start Time','End Time',TimeUnit.Hours),0)

Data Types: 'Start Time' – Date/Time,  'End Time' – Date/Time

 

Does anyone know how to fix this? Any help would be appreciated!
Thanks, SBX

I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at

    HI @SBX,

    I have tested it on my side, and it works,

    vqiaqimsft_0-1704984035645.png

     

    I think maybe you should replace the number with the parameter named with StartOfWeek.

    Check this:

    Weekday('Start Time',StartOfWeek.Monday)

     

  • SBX Profile Picture
    4 on at

    Thanks Qi, 

    This is for a model driven app using the Dataverse. I’m trying to enter this calculated column in a table within the Dataverse.

    Weekday('Start Time',StartOfWeek.Monday) – I’ve already tried this it wont work.

     

    SBX_0-1704985767804.png

     

  • Rusty2 Profile Picture
    on at

    I am having the same issue.

    In the documentation for this formula here Work with Dataverse formula columns - Power Apps | Microsoft Learn
    It says: StartOfWeek argument isn't supported for the WeekNum and Weekday functions in formula columns.

    So what is the solution to find the week beginning or ending a certain date?

    I've tried:

    Now() + (7 - Weekday(Now(), 0)) - it errors on the 0 saying Invalid argument type (Decimal). Expecting a Enum (StartOfWeek) value instead.
    Now() + (7 - Weekday(Now(), StartOfWeek.Sunday)) - errors on the Sunday saying The start_of_week argument is not supported for the Weekday function in formula columns.
     
    So we cannot use Weekday, Weeknum or StartOfWeek in these formulas.

    I also looked at using calculated columns but have the same issues
  • yogimoyyila Profile Picture
    2 on at

    I have timestamp "7/8/2024 2:51 PM" i need to identify the which weekday of the current timestamp(like Monday, Tuesday) tried multiple ways as mentioned above but nothing worked. please suggest me the way to identify the weekday from the timestamp column.

    Link below for dataverse doc

    https://learn.microsoft.com/en-us/power-apps/maker/data-platform/formula-columns?tabs=type-or-paste#guidelines-and-limitations

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