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 / Setting default select...
Power Apps
Answered

Setting default selection of ComboBox to a value from different SharePoint list based on current date

(0) ShareShare
ReportReport
Posted on by

Hello, 

 

I have a SharePoint list with period definition (essentially weeks) - defined by 'name' and then 'starting' and 'ending' date

Ajwou_0-1684752746769.png

I would like to use this Sharepoint list in my app, where depending on the current date, 'Week Number' (Combo box) gets filled in (default value) . 

Ajwou_1-1684752890746.png

Please could anyone help?

 

Kind Regards, 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,781 Most Valuable Professional on at

    Hi @Ajwou ,

    The DefaultDate (using the names you provided)

    LookpUp(
     SPList,
     name = 'Week Number'.Selected.Week
    ).'Start Date'

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Ajwou Profile Picture
    on at

    Hi @WarrenBelz 

    I tried the suggested workflow, however it didn't work. I think I haven't explained the issue properly. 

    At the moment I have an app, that uses a sharepoint list. Within the app, I have date control, where I can select a date (default set to 'today') and also combobox control, which is linked to another sharepoint list with defined periods (period label, starting and ending date). So what I am trying to achieve to take selected date (today) in the app, find in which period (range in the child SP list) it belongs and return the 'week label' for that period into the combobox.  

  • Verified answer
    WarrenBelz Profile Picture
    153,781 Most Valuable Professional on at

    Hi @Ajwou ,

    I think you need it "backwards" from what I posted = the DefaultSelectedItems of the Combo Box

    {
     week:
     LookUp(
     SPList,
     'Start Date' = YourDatePicker.SelectedDate
     ).week
    }

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Ajwou Profile Picture
    on at

    Hi @WarrenBelz , 

     

    I have used the code, however noting returns. Is the formula considering the range?

     

    We have a "random" date (in the date picker) and the task is to find in which period this date sits. The date is not  defined in the child SP list exactly, there are only ranges ie:
    Today is 23/05/2023 and the data in the SP list would be Week 5, then period starting date 22/05/2023 and ending date of that period 28/05/2023. So the formula would return Week 5 in this case. 

  • Ajwou Profile Picture
    on at

    Hello @WarrenBelz , 

    I took your suggestion and further adjusted it to look at the ranges:

    {
    Week:
    LookUp(
    'Periods and Weeks',
    'Start Date' <= DataCardValue5.SelectedDate && 'End Date'>=DataCardValue5.SelectedDate
    ).Week
    }

     

    This seems to work now. Hopefully I am not missing anything. 

     

    Thank you very much @WarrenBelz for your help!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 88

#2
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 45

Last 30 days Overall leaderboard