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 / Help on Date range at ...
Power Apps
Unanswered

Help on Date range at power app

(1) ShareShare
ReportReport
Posted on by 49

Hi All,

 

Requesting help on below:

Getting user inputs for below fields and inserting into excel.

Manager,Team and Names are dependent dropdowns

nishak323_0-1697378971582.png

Used below code :

 

 

// Check if a record with the same Name and Date already exists
Set(
 existingRecords,
 Filter(
 Table1,
 Name = 'ComboBox1_4 name'.Selected.Value &&
 Date = DatePicker1.SelectedDate
 )
);

 

 

If(
 CountRows(existingRecords) > 0,
 // Get the name of the existing record
 Set(
 existingRecordName,
 First(existingRecords).Name
 );
 Notify("A record with the same Name and Date already exists for " & existingRecordName, NotificationType.Error),
 // If no existing record found, add a new record
 ForAll(
 'ComboBox1_4 name'.SelectedItems As C,
 Patch(
 Table1,
 Defaults(Table1),
 {
 Manager: 'Dropdown1_4 -mng'.Selected.Value,
 Team: 'Dropdown2_4- team'.Selected.Value,
 Name: C.Value,
 Date: DatePicker1.SelectedDate,
 Hours: TextInput1.Text,
 Leave: 'Dropdown4-leave'.Selected.Value
 }
 )
 );
 Navigate(DataTable1)
)

 

 

Now my requirement is to choose a date range : - To select multiple date values with remaining field values in separate rows.

Got to know it could be achieved by using 2 date pickers (start and end) ,requesting help in modifying above with date range.

 

Any help in implementation steps would be highly appreciable !!!

Categories:
I have the same question (0)
  • jadhav_ravi_oo7 Profile Picture
    276 on at

    Hey Hii Your Exect Soln You Will Find in This video I Created The Same Senario in his 

    like - 

    Got to know it could be achieved by using 2 date pickers (start and end) ,requesting help in modifying above with date range.

    kindly check it- https://youtu.be/qTXZh06nqBQ?si=QW561C71tz7lM97O

     

    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others.

     

    Thanks & Regards,

    Ravindra Jadhav

    Independent Consultant | Freelancer 

    +91-9146152149

    Connect Me On Different Platforms

    LinkedIn || YouTube ||Blogger ||

     

  • nishak323 Profile Picture
    49 on at

    Hi Ravindra ,

    Thank you for the reply and the video was informative . I tried incorporating date range part into my req.

    But its not working out .Can you help on below.

     

    // Check if a record with the same Name and Date already exists
    Set(
     existingRecords,
     Filter(
     Table1,
     Name = 'ComboBox1_4 name'.Selected.Value &&
     Date = DatePicker1.SelectedDate
     )
    );
    
    Filter(existingRecords,
    Date >='DatePicker 2'.SelectedDate,
    Date <='DatePicker 3'.SelectedDate 
    );
    
     
    If(
     CountRows(existingRecords) > 0,
     // Get the name of the existing record
     Set(
     existingRecordName,
     First(existingRecords).Name
     );
     Notify("A record with the same Name and Date already exists for " & existingRecordName, NotificationType.Error),
    
     // If no existing record found, add a new record
     If(CountRows(existingRecords) > 0,ForAll(Sequence(5),Collect(existingRecords,{Date:DateAdd(Today(),Value*DateDiff(Today(),Today()+1)},
     ForAll(
     'ComboBox1_4 name'.SelectedItems As C ,
    
     
     Patch(
     Table1,
     Defaults(Table1),
     {
     Manager: 'Dropdown1_4 -mng'.Selected.Value,
     Team: 'Dropdown2_4- team'.Selected.Value,
     Name: C.Value,
     Date: DatePicker1.SelectedDate,
     Hours: TextInput1.Text,
     Leave: 'Dropdown4-leave'.Selected.Value
     }
     )
     );
     Navigate(DataTable1)
    )

     

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard