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 / How to add half day fo...
Power Apps
Unanswered

How to add half day for the total days of leave

(0) ShareShare
ReportReport
Posted on by 249

Dear Powerapps Teams, 

 

I can get the total number of days leave in my app but I got confused with the solutions here that I followed if I want to add a half day leave. This is what I have at the moment:

 

LeaveDays1.PNG

 

I tried  this solution from this link: https://powerusers.microsoft.com/t5/Building-Power-Apps/Leave-Request-template-Add-Selection-for-Full-Day-s-Half-Day-AM/m-p/189152 but I have no luck. 

I also tried : https://powerusers.microsoft.com/t5/Building-Power-Apps/My-leave-request-template-Balance-Add-Selection-checkbox-for/td-p/604266 - but I got confused. 

 

Here is my fx: 

DateDiff(
DatePicker1_2.SelectedDate,
DatePicker1_3.SelectedDate,Days
) + 1

 

 

Can anyone please help me with my problem? 

 

 

 

 

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @kharina :

    Do you want to add a "half day" option to this app?

    I suggest you add the options of ‘AM’ and ‘PM’ for both the start date and the end date, so that you can distinguish the "half day".I'v made a test for your reference:

    1\Add a Radio control(Radio-Start) for DatePicker1_2 and set it's items property to:

    ["AM","PM"]

    Layout

    Layout.Horizontal

    2\Add a Radio control(Radio-End) for DatePicker1_3 and set it's items property to:

     

    ["AM","PM"]

     

    Layout

     

    Layout.Horizontal

    3\Set the label control's Text property to:

    DateDiff(
     Switch(
     'Radio-Start'.Selected.Value,
     "PM",
     DateAdd(DatePicker1_2.SelectedDate,12, Hours),
     DatePicker1_2.SelectedDate
     ),
     Switch(
     'Radio-End'.Selected.Value,
     "PM",
     DateAdd(DatePicker1_3.SelectedDate,12,Hours),
     DatePicker1_3.SelectedDate
     ),
     Hours
    ) / 24

    62.gif

    Best Regards,

    Bof

     

     

  • kharina Profile Picture
    249 on at

    Hello Bof @v-bofeng-msft , 

    I tried your solution - and it really worked for the half day. However, If I don't select any because I wanted a full day leave, the syntax cannot compute the "full days" that are selected  from the calendar:

     

    kharina_0-1602645123053.png

     

    May I ask what should I add ?

     

    Thank You and Kind Regards,

    Kharina

     

     

     

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard