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 / Conditional formatting...
Power Apps
Answered

Conditional formatting Gallery Color by two value

(0) ShareShare
ReportReport
Posted on by 30

Hello,

I try to use a If formula who can change color of my Gallery.
It work perfectly when i do that with one value: 

 

If(ThisItem.'Problème ?'=true;Red;If(ThisItem.'Problème ?'=false;Green))

 



but i want to do something with two value in the same time 

 

If(ThisItem.'Problème ?'=true;Red;If(ThisItem.'Problème ?'=false;Green;If(ThisItem.'Résolu ?'=true&ThisItem.'Problème ?'=true;Blue)))

 

 

in more mathematical way i want this 

 

If ValueA = true -> Red
If ValueA = False -> Green
If ValueA = True AND ValueB = true -> Blue

 


The condition must be ruled by two fonction.

Hope someone can help me, its look eay but i'm stuck at this point. (The app will be finished after that)

Regards
Arthur



Categories:
I have the same question (0)
  • Arne_R Profile Picture
    97 on at

    Hi, 

    I don't know if this works. But you can try it.. 

     

    If(
     valueA = true && valueB = true ; "Blue";
     valueA = true && valueB = false ; "Red";
     valueA = false && valueB = true ; "Green";
     valueA = false && valueB = false ; "/"
    )

     

     

    Arne

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    You should be able to test for the "True" version, then the "And" and then use the "else" part of the original If for the 

    "False" version:

    If(ThisItem.'Problème ?'=true;Red;If(ThisItem.'Résolu ?'=true&ThisItem.'Problème ?'=true;Blue);Green)

    the syntax may not be exactly right as my version uses "," whereas yours uses ";", but it should be close

  • SoPatt Profile Picture
    Microsoft Employee on at

     

    Your code, formatted for readability (plus my comments):

    If(ThisItem.'Problème ?'=true;
     Red;
     If(ThisItem.'Problème ?'=false;
     Green;
     If(ThisItem.'Résolu ?'=true & ThisItem.'Problème ?'=true
     ;Blue // can never be reached because ThisItem.'Problème ?' is false
     // also operator & is the concatenation operator; && is the logical and operator
     )
     )
    )

     

    I'm assuming a little bit but this might be what you want:

     

    If(ThisItem.'Problème ?'; // =true is redundant
     If(ThisItem.'Résolu ?';
     Blue; // ValueA && ValueB 
     Red; // I'm guessing you meant that you want red if ValueA && !ValueB
     );
     Green
    )

     



  • SoPatt Profile Picture
    Microsoft Employee on at

    This can't work because in the else part of If(ThisItem.'Problème ?'=true...), ThisItem.'Problème ?' must be false. thus Blue can never be returned and therefore this is logically identical to If(ThisItem.'Problème ?';Red;Green)

  • Verified answer
    BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    I just tested this and it works:

    If(ValueB And ValueA,Blue,!ValueA,Green,Red)

    You will need to replace "," with ";" 

  • arthurbeaulieu Profile Picture
    30 on at

    Thank you All for your reply, this place is very helpfull for beginner like me ! i try the @BrianS solution and it work perfectly. This elegant single line is what i need. But i want to thank you all for your contribution 

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 392

#2
WarrenBelz Profile Picture

WarrenBelz 364 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 271 Super User 2026 Season 1

Last 30 days Overall leaderboard