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 / Fill colour based on t...
Power Apps
Answered

Fill colour based on two gallery rows

(0) ShareShare
ReportReport
Posted on by 774 Moderator

Hi all! 

 

Here's the scenario:

I have a gallery which displays a range of dates in a sequence starting with one saved in a variable, I also colour cells that correspond to some datapoints I have recorded in splist. what I would like to do is automatically colour the cells between the two key cells in the example from the screenshot I'd like the cells between the 14 and 18th to be in the sky blue (just like the 14th) same for any other gaps e.g. if there was a gap between 18th and 20th I'd like the 19th to be in red too.

 

any idea for a solution please?

 

ps. each date is a separate table row (the gallery is 7 wrap)

 

Thank you

Seb

elseb_0-1689879833471.png

 

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,501 on at

    Hey @elseb 

     

    Probably in your case you can use conditional formatting on the data points in the SP List.

     

    First, you need to fetch the data points recorded in the SP List that correspond to the dates in your gallery. You can use a data source or collection to store the data points.

    Once you have the data points, you can update the conditional formatting of the gallery cells based on the date range. For each cell, check if it falls within the date range defined by the key cells (e.g., between the 14th and 18th). If it does, apply the sky blue color. If there are additional gaps between other key cells, you can apply different colors accordingly.

     

    You can use a similar expression as below:

     

    // Define the start and end dates of the range
    Set(startDate, DateValue("14-05-2023"));
    Set(endDate, DateValue("18-05-2023"));

    // Conditional formatting for the gallery cells
    If(
    ThisItem.Date >= startDate && ThisItem.Date <= endDate,
    ColorValue("SkyBlue"),
    If(
    // Apply additional formatting for other date ranges if needed
    // For example, between 18th and 20th in red:
    ThisItem.Date >= DateValue("18-05-2023") && ThisItem.Date <= DateValue("20-05-2023"),
    ColorValue("Red"),
    // Default formatting for other cells
    ColorValue("DefaultColor")
    )
    )

     

     

     

    In the above expression, we use the If function to check if the date in each gallery cell falls within the range defined by the start and end dates (14th and 18th). If it does, the cell will be colored sky blue. If there are additional date ranges to consider, you can add more If statements to apply the desired colors accordingly.

    Adjust the date values and colors as needed based on your specific date ranges and styling preferences. Additionally, make sure to replace the "DefaultColor" with the actual default color of the cells.

     

     

    I hope this helps 🙂

     

  • elseb Profile Picture
    774 Moderator on at

    Thank you for the reply, i think i should word it differently but i wasn't sure how to explain it, so this solution will work nicely it i look for static datapoints, in my case what i actually need is detecting changes and using it for what you described imagine this:

    I have a sequence of dates between start and end (this is mostly static so easy to format) but in between i can have an event and it could be one of 5 events represented in different colour. what i need to do is colour all the rows from start to the next event then change the colouring based on that event and then colour all the cells from that change to the next and so on. 

    And explaining that i kind of just come up with potential solution 😄 i will try it now and see if that solve my problem...

  • Verified answer
    elseb Profile Picture
    774 Moderator on at

    I'll reply to my own post but it may benefit someone in the future so here's my solution to the problem:

    If(
     IsBlank(
     LookUp(
     colStatusChangeRecords, 
     status_changed_date = ThisItem.Value
     )
     ), 
     Last(
     Filter(
     colStatusChangeRecords, 
     status_changed_date < ThisItem.Value
     )
     ).status, 
     LookUp(
     colStatusChangeRecords, 
     status_changed_date = ThisItem.Value
     ).status
    )

    This way it populates the empty cells with the last changed status. The code above goes in text label because this is was easier to visualise but then the fill colour will be based of the result.

     

    Seb

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
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard