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 / Change button colour f...
Power Apps
Answered

Change button colour fill via formula

(0) ShareShare
ReportReport
Posted on by 73

Hi I'm trying to change the colour fill of a button based on whether the logged-on user has a value in the SharePoint choice column 'Planning' of more than 5 and less than 7.  The logged-on users' email is held as a global variable - varUser.

 

So I have been trying variations of this without success, stored on the Fill condition of the button:

 

If(!IsBlank(Filter('Staff Dev','Team Member'.Email = varUser && 'Planning' > 5 && 'Planning' < 7)),RGBA(0,255,0,1),RGBA(255,0,0,1))
 
I have tried swapping the && for an And formula and , but this has not worked. If I bin off the conditions for the choice column and just test the colour change against the logged on user the colour selection works fine. Can anyone suggest a correction for the formula?
 
Thanks in advance!
Categories:
  • BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @WalesMariner ,

     

    The Filter function will return a table, hence IsBlank is not the right function to use to evaluate if no items exist. Instead, try using the IsEmpty function:

     

    If(
     !IsEmpty(
     Filter(
     'Staff Dev',
     'Team Member'.Email = varUser && 'Planning' > 5 && 'Planning' < 7
     )
     ),
     RGBA(0,255,0,1),
     RGBA(255,0,0,1)
    )
  • enriqueglopez Profile Picture
    518 Moderator on at

    I think is easier to read if you validate before that which color the user should see, store the hexadecimal value in a variable and use ColorValue() in the button.

     

    For example:

     

    OnVisible property of the Screen (or wherever you want)

     

    If
    (
    !IsBlank(Filter('Staff Dev','Team Member'.Email = varUser && 'Planning' > 5 && 'Planning' < 7)),
    Set(VarColor, "#00ff00d9"),
    Set(VarColor, "#ff0000d9"),
    )

     

    Fill Property of the button:

    ColorValue(VarColor) 

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.

  • WalesMariner Profile Picture
    73 on at

    Updating to !IsEmpty, I'm still getting the red line under && 'Planning' with the problem handling saying 'Invalid argument type - expecting one of the following number, decimal, date, time , date time, untypedobject'

     

     

  • Verified answer
    BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @WalesMariner ,

     

    I missed the part where you mentioned Planning is a choice column, which is causing the issue since choice columns return an object, not a number. If you select the value, the formula should work although you may have to wrap that in Value formulas:

     

    If(
     !IsEmpty(
     Filter(
     'Staff Dev',
     'Team Member'.Email = varUser && 'Planning'.Value > 5 && 'Planning'.Value < 7
     )
     ),
     RGBA(0,255,0,1),
     RGBA(255,0,0,1)
    )

     

    This is what it looks like when also applying the Value function which is needed if the above doesn't yield result:

    If(
     !IsEmpty(
     Filter(
     'Staff Dev',
     'Team Member'.Email = varUser && Value('Planning'.Value) > 5 && Value('Planning'.Value) < 7
     )
     ),
     RGBA(0,255,0,1),
     RGBA(255,0,0,1)
    )

     

  • WalesMariner Profile Picture
    73 on at

    @BCBuizer  that's great thanks! I'm stil getting a delegation warning under the value section of the formula is this something I can just ignore as my dataset won't go over 500 records or is there something that can be tweaked to remove that?

  • BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @WalesMariner ,

     

    If your dataset has less than 500 items, you can just ignore it. 

     

    The fix is to change the column type from Choice to a Number, but that will require some changes to your app as well.

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 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard