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 / combobox is not resetting
Power Apps
Answered

combobox is not resetting

(1) ShareShare
ReportReport
Posted on by 24

On app start, I use

 
ClearCollect(
ColKey,
Distinct(
Filter(
'Global Measures',
'Objective Period' in ComboBoxp.SelectedItems.Value
),
'Key Priority'.'Key Priority'
)
)
 
 

  •  

    My Key ComboBox items are set t0



  •  
 
Filter(
'Key Priorities',
'Key Priority' in ColKey.Value,
'Key Priorities (Views)'.'Active Key Priorities'
)
 
 

  •  

    The DefaultSelectedItems for the Key ComboBox is



  •  
 
Filter(
'Key Priorities',
'Key Priority' in ColKey.Value
)
 
 

  •  

    The Objective Period ComboBox items are: Choices('Objective Period').



  •  
 

Problem:

 

  •  

    When the app opens, the year defaults to 2026 and the Key ComboBox shows one item, which is correct.


  •  

    When I change the year to 2025, all items are selected.


  •  

    When I change the year back to 2026, all items are selected again, even though I want only one item selected in the Key ComboBox.


  •  

    I tried using Reset(ComboBoxKey), but it doesn’t fix the issue.

Categories:
I have the same question (0)
  • Suggested answer
    Assisted by AI
    pankaj3 Profile Picture
    20 on at

    Step-by-step (Power Apps)

     

    1) App start (or Screen OnVisible) — build the key list

    App.OnStart (or Screen.OnVisible):

    ClearCollect(ColKey, Distinct(Filter('Global Measures','Objective Period' in ComboBoxp.SelectedItems.Value),'Key Priority'.'Key Priority'))
     
    🔎 Note: Distinct(...) returns a column named Result.
     

    2) Objective Period ComboBox (year) — Items

    • ComboBoxp.Items:
    Choices('Objective Period')
     

    3) Rebuild and reset when year changes

    ComboBoxp.OnChange:

    ClearCollect(ColKey, Distinct(Filter('Global Measures','Objective Period' in ComboBoxp.SelectedItems.Value),'Key Priority'.'Key Priority')); Reset(ComboBoxKey)
     

    4) Key ComboBox — Items (filter with Result)

    • ComboBoxKey.Items:


    •  
    Filter('Key Priorities','Key Priority' in ColKey.Result,'Key Priorities (Views)'.'Active Key Priorities')
     

    5) Key ComboBox — DefaultSelectedItems (select one only when exactly one match)

    ComboBoxKey.DefaultSelectedItems:
    With({k:ComboBoxKey.Items}, If(CountRows(k)=1, [First(k)], []))
  • Verified answer
    Inogic Profile Picture
    1,291 Moderator on at
    Hi,
     
    This behavior happens because ComboBoxKey has both Items and DefaultSelectedItems directly tied to ColKey.

    When the Objective Period changes:
    • ColKey gets rebuilt
    • The Items list refreshes correctly
    • But the ComboBox keeps its previous internal selection
    • Power Apps merges old and new selections
    • As a result, all items appear selected

    Reset() alone does not resolve it because DefaultSelectedItems is still dynamically referencing ColKey.

    Simple Fix

    Store the default selection in a variable instead of binding it directly to ColKey.

    Update ComboBoxp - OnChange

    ClearCollect(
        ColKey,
        Distinct(
            Filter(
                'Global Measures',
                'Objective Period' in ComboBoxp.SelectedItems.Value
            ),
            'Key Priority'.'Key Priorities (new_keyprioritiesid)'
        )
    );

    Set(
        varDefaultKey,
        Filter(
            'Key Priorities',
            'Key Priorities (new_keyprioritiesid)' in ColKey.Value,
            'Key Priorities (Views)'.'Active Key Priorities'
        )
    );

    Reset(ComboBoxKey);



    Update ComboBoxKey  - Items

    Filter(
        'Key Priorities',
        'Key Priorities (new_keyprioritiesid)' in ColKey.Value,
        'Key Priorities (Views)'.'Active Key Priorities'
    )

    DefaultSelectedItems
    varDefaultKey





    This ensures:
     
    • Previous selections are cleared
    • Only the correct keys are selected
    • Switching years no longer selects all items
    Hope this helps
     
    Thanks!
    Inogic
  • RV-13100656-0 Profile Picture
    24 on at
    @With({k:ComboBoxKey.Items}, If(CountRows(k)=1, [First(k)], [])) not working
    for 2026 i have 1 key priority and for 2025 i have 3key priorities.
    If i open the app am getting default 2026 year and keyPriority is 1 then year changed to 2025 it is selecting all and changing to 2026 it is again selected to all but it should selected to one.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard