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 / how to add drop down v...
Power Apps
Answered

how to add drop down value 1 to the other dropdown value

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello Everyone 
I have a 4 dropdown and 2 datepicker with me
below is the start date, start hour (in hours item its from 0-24); start min (in min items it is only 00 and 30)

PDRC_0-1669183934223.png
below is the End date, End hour (in hours item its from 0-24); End min (in min items it is only 00 and 30)

PDRC_1-1669184047116.png

 
I have a text box Duration which show calculation in min 
if I change start date to today and end date to tommorrow then this fails
but if I keep any same it works fine

PDRC_2-1669184418610.png

formula:-

('drp EndHour'.Selected.Value*60+'drp EndMin'.Selected.Value)-
('drp StartHour'.Selected.Value*60+'drp StartMin'.Selected.Value)

 What I want is:
if Start Date= 23/11/2022  || Start hour = 20 || Start Min = 30
   End Date = 24/11/2022  || End hour = 01   || End Min = 30
then Duration should show ->300 min (ie., 5 hours)

I want to calculate duration even if date changes .
Plus by default its should be able to show 60 min (Which I should be able to change it)

If anyone knows how to do it please let me know, it will be very helpfull.

Categories:
  • Sundeep_Malik Profile Picture
    6,501 on at

    Hey @Anonymous 

     

    Found a similar solution to your problem. You can refer to it:

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Adding-hours-to-date/td-p/171714

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Since you are using Date Pickers, you can treat them both as Date and time values, and your requirement changes to calculate the difference between two date and time values, which is easy to achieve using DateDiff function:

    DateDiff(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0),DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value), Value(MinuteValue2.Selected.Value), 0))

    vjefferni_0-1669189051204.pngvjefferni_1-1669189067621.png

    vjefferni_2-1669189093925.png

    To set the default to 60, could you please tell more details? Would you like to force the default end date and time adjust correspondingly to 60 minutes later than start date and time?

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @v-jefferni , Thank you for the help
    by default 60 means
    eg;
    Start hour -> 1
    End Hour-> 2 (Start Hour + 1)

    Once I select any hour from start hour , end hour should always be + 1.
    I am trying this but it is not working:-
    Dropdown-> End Hour -> Default property -> (Starthour.selectedText.value)+1

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Use DateAdd function to add 60 minutes to start date time to get the default end date time. With this time, you can leverage DateValue, Hour and Minute function to get respective values and set in DefaultDate and Default properties of the end date time Dropdowns:

    vjefferni_0-1669190690060.png

    DateValue(DateAdd(DateValue1_1.SelectedDate + Time(Value(HourValue1_1.Selected.Value), Value(MinuteValue1_1.Selected.Value), 0),60,Minutes))
    Hour(DateAdd(DateValue1_1.SelectedDate + Time(Value(HourValue1_1.Selected.Value), Value(MinuteValue1_1.Selected.Value), 0),60,Minutes))
    Minute(DateAdd(DateValue1_1.SelectedDate + Time(Value(HourValue1_1.Selected.Value), Value(MinuteValue1_1.Selected.Value), 0),60,Minutes))

     

    You can add an invisible Label similar to mines and use Label.Text instead to simplify the formulas:

    vjefferni_1-1669190922145.png

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @v-jefferni  
    thank you so much for the help, I really appreciate.

    but I wolud like to infor you that this works from 9 and above,
    So  suppose I select Start hour as 01 its shows End hour as 00 only

    PDRC_0-1669195766065.png

    PDRC_1-1669195800428.png


    its working from 9 onwards 

    PDRC_2-1669195830123.png

    Why it is failing?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @Sundeep_Malik 
    Thank you so much for refering this blog.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-jefferni  Can you please help me with the code you told me for the default 60 min

    PDRC_0-1669279928525.png

    it is working from 9 and above and not for 1 to 8
    if I get a text and see the output in there I am able to see to see it correctly but if I am using drop down and its not showing properly.
    @v-jefferni ,What should I do to see correct in dropdown?.

     

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Found the problem, caused by the format of numbers. Please add a Text function for the hour dropdown to force the number to be two digits:

    Text(Hour(DateAdd(DateValue1_1.SelectedDate + Time(Value(HourValue1_1.Selected.Value), Value(MinuteValue1_1.Selected.Value), 0),60,Minutes)),"00")

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-jefferni thank you for helping me

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard