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 / Set Variable based on ...
Power Apps
Answered

Set Variable based on selection NOT chosen

(0) ShareShare
ReportReport
Posted on by 75

Please Help!

 

I have a customized from from a SharePoint List. I have a multi-select Drop Down with 3 values: "2 Monitors", "Laptop/Desktop", and "Mouse".

 

OnChange, I need to set a variable to what IS NOT selected. So if "2 Monitors" and "Laptop/Desktop" are selected, the variable will show "Mouse", etc.

 

I tried an IF statement but it will only pass the first argument and some just flat out don't work at all. I've used &, &&, ||, and regular IF.

If(
	Not( 
		"2 Monitors" in DataCardValue5.SelectedItems), 
			Set(VarMonitorMissing, " 2 Monitors "), 
	Not( 
		"Mouse" in DataCardValue5.SelectedItems), 
			Set(VarMouseMissing, " Mouse "), 
	Not( 
		"Laptop/Desktop" in DataCardValue5.SelectedItems), 
			Set(VarComputerMissing, " Laptop/Desktop ")
	)
	
	
	
If(	"2 Monitors" & "Mouse" & "Laptop/Desktop" in DataCardValue5.SelectedItems, Set(varMissing," "), 
 "2 Monitors" & "Mouse"	in DataCardValue5.SelectedItems, Set(varMissing, " Laptop/Desktop") , 
	"2 Monitors" & "Laptop/Desktop" in DataCardValue5.SelectedItems, Set(varMissing, " Mouse ") , 
 "Mouse" & "Laptop/Desktop" in DataCardValue5.SelectedItems, Set(varMissing, " 2 Monitors " )
 )

 

These will then show a message to the user and send an email to IT telling them which equipment the user needs to proceed.

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @cbristol 

    Keep it simple!!

     

    Please consider changing your Formula to the following:

    Concat(Filter(["2 Monitors", "Laptop/Desktop", "Mouse"], !(Value in DataCardValue5.SelectedItems.Value)), Value & ", ")

     

    This will give you the list of what is not selected.

     

    I hope this is helpful for you.

  • cbristol Profile Picture
    75 on at

    LIKE A CHARM! Thank you!!!

  • cbristol Profile Picture
    75 on at

    Now I need to hide a text box if all values are present, can't seem to figure that out either.

     

    Visible:

     

    If(Not( varMissing = "2 Monitors, Laptop/Desktop, Mouse"), true, false)

     

     

     

    If( Not("2 Monitors" && "Laptop/Desktop" && "Mouse" in DataCardValue5.SelectedItems.Value), true, false)

     

     

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @cbristol 

    Since you have three items...

    Set the Visible property to:

    !(CountRows(DataCardValue5.SelectedItems)=3)

     

  • cbristol Profile Picture
    75 on at

    Thank you!!!! So simple

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @cbristol 

    Yes...keep it simple!!  

    Don't think "development" - you are not developing, you are writing formulas.  That's how PowerApps works.  It was designed after Excel, so think in terms of formulas that provide results.  

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 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard