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 / BrowseGallery conditio...
Power Apps
Answered

BrowseGallery conditional formatting not appearing how I wanted to.

(0) ShareShare
ReportReport
Posted on by 33

Hi @WarrenBelz please assist, it's a continuation from 

https://powerusers.microsoft.com/t5/Building-Power-Apps/If-amp-Or-condition-help/m-p/922578#M292656

BrowseGallery > TemplateFill, I have the following codes written as shown below.

 

With(
 {
 dDate1: DateDiff(
 Today(),
 ThisItem.FO_OUT,
 Months
 ),
 dDate2: DateDiff(
 Today(),
 ThisItem.KMC_OUT,
 Months
 ),
 dDate3: DateDiff(
 Today(),
 ThisItem.SNP_OUT,
 Months
 ),
 dDate4: DateDiff(
 Today(),
 ThisItem.SRP_OUT,
 Months
 ),
 dDate5: DateDiff(
 Today(),
 ThisItem.SUT_OUT,
 Months
 ),
 dDate6: DateDiff(
 Today(),
 ThisItem.SLNG_OUT,
 Months
 ),
 dDate7: DateDiff(
 Today(),
 ThisItem.TMUC_OUT,
 Months
 ),
 dDate8: DateDiff(
 Today(),
 ThisItem.TSPR_OUT,
 Months
 )
 },
 If(
 dDate1 < 1 || dDate2 < 1 || dDate3 < 1 || dDate4 < 1 || dDate5 < 1 || dDate6 < 1 || dDate7 < 1 || dDate8 < 1,
 Red,
 dDate1 < 3 || dDate2 < 3 || dDate3 < 3 || dDate4 < 3 || dDate5 < 3 || dDate6 < 3 || dDate7 < 3 || dDate8 < 3,
 Yellow,
 White
 )
)

 

The image attached below are my BrowseGallery and they are just names. 

1.jpg

The image attached below are just the DetailForms indicating the expiry date. They react with the colour red, yellow and white based on the code found above.

2.jpg

Let us pay more attention to the code shown below as summarized from the original code,

 

If(
 dDate1 < 1 || dDate2 < 1 || dDate3 < 1 || dDate4 < 1 || dDate5 < 1 || dDate6 < 1 || dDate7 < 1 || dDate8 < 1,
 Red,

 

To summarized, as long as any dDate expires, the BrowseGallery must show red. Same can be said with yellow provided there's no red, then the BrowseGallery must show yellow.

Now refer to the two image, BrowseGallery under the name "Mohammad Shazarul Bin Ishak".

It should have shown red instead it is yellow. 

Where did I went wrong?

 

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @Khairudin ,

    The formula is sound as far as detecting the difference in whole months - today is June 6 - which date are you referring to that you believe is wrong?

  • Khairudin Profile Picture
    33 on at

    Dear @WarrenBelz ,

     

    I found what seems to be the problem. You hinted about which date I believe was wrong. 

    Since the present date is 6th of June and referencing that with 27th of July from the detailForm, the fill should turn yellow but it is evidently red.

    So I thought what if PowerApp assume the difference between those dates are taken from either the first date/last date of the months hence giving a result < 1 month which explains why the detailForm is showing red.

    So I change months to days and it works!

    Thanks!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard