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 / Generate gallery based...
Power Apps
Answered

Generate gallery based on condition

(0) ShareShare
ReportReport
Posted on by 8

Hello Power Users,

 

Is there any way to create in Power Apps a similar dashboard as attached (first line is the header)? I'm using an Excel spreadsheet as data. Among other columns there are 2 columns Job family and color.

I was able to manually create a gallery for each color (like light green and show the corresponding job title Senior Comp&Ben Specialist EU and Compensation & Benefits Lead) , but I was wondering if this could be done automatically using a condition like: if job family is Coordinator and color is Light green, generate a gallery and show those positions matching the filtering criteria.

Thank you.

 

Cristian

dashboard.JPG
Categories:
I have the same question (0)
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    You can't dynamically create a gallery, although you can dynamically control how it looks using filter formulas and properties such as visible and fill.

     

    Here is an example of a fill property

     

    If(
     ThisItem.JobFamily = "Coordinator" && ThisItem.Color = "Light Green", RGBA(102, 182, 227, 1),
     RGBA(167,182,203,1)
    
    )
  • CristianR Profile Picture
    8 on at

    Thanks for your quick reply @JR-BejeweledOne . The problem is that each job title should be displayed in an exact position (example: Comp&Ben Specialist EU and Compensation & Benefits Lead positions should appear on the Coordinator/Senior column) and if there are multiple jobs matching the JobFamily and Color they should go one below the other like in the attached picture from my initial message. Any thoughts how to achieve that?

    Thank you.

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Actually I think there is.   It would involve the gallery wrapcount property and multiple galleries.   I just watched a video on this yesterday.   Give me some time to see if I can make it work.

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Would you be able to share these columns from your spreadsheet,  Job, JobFamily and Color.   It looks like you have a specific ordering for the colors, e.g. red, then orange, yellow and green.    Are there other colors and can you share your order for the colors?

  • Verified answer
    JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I was able to accomplish creating a dashboard.   It requires a lot of formulas to make it work, but it does work.    Note:  It is a little 'choppy' when changing the output.   Not sure how I could make it smoother.

     

    I used a SharePoint list for my data, so you will need to adapt the formulas to Excel.  For this to work you will need to add a column to your data source called Position.   Each color has a specific position in the gallery.  Position 1 is reserved, so start with Position 2, which should be the top position in the gallery and go down.  

     

    In this example:

     

    Color Position
    Red 2
    Gold 3
    Yellow 4
    Green 5

     

    In your App Onstart, create a collection, I only used the columns needed to create the dashboard.  My dashboard is view only, you can't click on anything:

    ClearCollect(Jobs, ShowColumns(Filter(TestDashboard, !IsBlank(Title)), "JobFamily", "Title", "Department", "Position"))

     

    On your Dashboard screen you need your header row.  I used Text Input fields set to 'View' mode in order to get the rounded corners, I set the radius property to 20.

     

    Next you need 7 vertical galleries.  Layout: Title.  The Items property for the gallery, Replace the Jobfamily with the correct one for each gallery (i.e. JobFamily = "Analyst", JobFamily = Specialist etc.)

    Sort(
     Filter(Jobs, 
     JobFamily = "Administrator" && Department = Dropdown3.Selected.Value), Position, Ascending
    )

     

    Set your label to the field containing the Job Title.   I added a button behind the label (no border on the label).  My button is 6 pixels wider than the label and 2 pixels higher (e.g. Label: X = 150, Y=45, Button: X = 156, Y = 47).   Right click the button and in "ReOrder" select 'Send Backwards to position it behind the label)

     

    The Button Fill property is:

    If(
     !IsBlank(ThisItem.Title) && ThisItem.Position = 2, RGBA(211, 30, 72, 1),
     !IsBlank(ThisItem.Title) && ThisItem.Position = 3, RGBA(252, 164, 55, 1),
     !IsBlank(ThisItem.Title) && ThisItem.Position = 4, RGBA(255, 207, 30, 1),
     !IsBlank(ThisItem.Title) && ThisItem.Position = 5, RGBA(159, 207, 105, 1),
     IsBlank(ThisItem.Title), RGBA(0,0,0,0)
     
    )

     

    I don't know what you will be using to change your dashboard items.   In this example I am using a dropdown that contains the department names.   In the OnChange of the gallery is where the work happens to make the dashboard appear the way you want.   what this is doing is counting each JobFamily item for the selected department in the collection.   If there is no position for a specific JobFamily and Position(Color), a row will be added to the collection that contains the DepartmentName, JobFamily and a position of '1'.    This is how the gallery items appear at the correct level.   You need a complete If statement as below for each JobFamily.    If there are additional colors other than the ones you showed that are at different levels, you will need to add a CountIf statement to each If statement.  It will go above the existing ones and each additional one you add will have a 1 more CountIf(Position =""..........) statement than the one below it.

     

    RemoveIf(Jobs, IsBlank(Title));
    
    If(
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Specialist"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Specialist"), Position = 3) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Specialist"), Position = 4) = 0, ForAll(Sequence(3), Collect(Jobs, { JobFamily: "Specialist", Department: Dropdown3.Selected.Value, Position: 1})),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Specialist"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Specialist"), Position = 3) = 0, ForAll(Sequence(2), Collect(Jobs, { JobFamily: "Specialist", Department: Dropdown3.Selected.Value, Position: 1 })),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Specialist"), Position = 2) = 0, Collect(Jobs, {JobFamily: "Specialist", Department: Dropdown3.Selected.Value, Position: 1})
    
    );
    
    If(
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Manager"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Manager"), Position = 3) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Manager"), Position = 4) = 0, ForAll(Sequence(3), Collect(Jobs, { JobFamily: "Manager", Department: Dropdown3.Selected.Value, Position: 1})),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Manager"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Manager"), Position = 3) = 0, ForAll(Sequence(2), Collect(Jobs, { JobFamily: "Manager", Department: Dropdown3.Selected.Value, Position: 1 })),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Manager"), Position = 2) = 0, Collect(Jobs, {JobFamily: "Manager", Department: Dropdown3.Selected.Value, Position: 1})
    
    );
    
    If(
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Administrator"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Administrator"), Position = 3) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Administrator"), Position = 4) = 0, ForAll(Sequence(3), Collect(Jobs, { JobFamily: "Administrator", Department: Dropdown3.Selected.Value, Position: 1})),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Administrator"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Administrator"), Position = 3) = 0, ForAll(Sequence(2), Collect(Jobs, { JobFamily: "Administrator", Department: Dropdown3.Selected.Value, Position: 1 })),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Administrator"), Position = 2) = 0, Collect(Jobs, {JobFamily: "Administrator", Department: Dropdown3.Selected.Value, Position: 1})
    
    );
    
    If(
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Analyst"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Analyst"), Position = 3) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Analyst"), Position = 4) = 0, ForAll(Sequence(3), Collect(Jobs, { JobFamily: "Analyst", Department: Dropdown3.Selected.Value, Position: 1})),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Analyst"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Analyst"), Position = 3) = 0, ForAll(Sequence(2), Collect(Jobs, { JobFamily: "Analyst", Department: Dropdown3.Selected.Value, Position: 1 })),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Analyst"), Position = 2) = 0, Collect(Jobs, {JobFamily: "Analyst", Department: Dropdown3.Selected.Value, Position: 1})
    
    );
    
    If(
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Coordinator"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Coordinator"), Position = 3) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Coordinator"), Position = 4) = 0, ForAll(Sequence(3), Collect(Jobs, { JobFamily: "Coordinator", Department: Dropdown3.Selected.Value, Position: 1})),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Coordinator"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Coordinator"), Position = 3) = 0, ForAll(Sequence(2), Collect(Jobs, { JobFamily: "Coordinator", Department: Dropdown3.Selected.Value, Position: 1 })),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Coordinator"), Position = 2) = 0, Collect(Jobs, {JobFamily: "Coordinator", Department: Dropdown3.Selected.Value, Position: 1})
    
    );
    
    If(
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Expert"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Expert"), Position = 3) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Expert"), Position = 4) = 0, ForAll(Sequence(3), Collect(Jobs, { JobFamily: "Expert", Department: Dropdown3.Selected.Value, Position: 1})),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Expert"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Expert"), Position = 3) = 0, ForAll(Sequence(2), Collect(Jobs, { JobFamily: "Expert", Department: Dropdown3.Selected.Value, Position: 1 })),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Expert"), Position = 2) = 0, Collect(Jobs, {JobFamily: "Expert", Department: Dropdown3.Selected.Value, Position: 1})
    
    );
    
    If(
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Director"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Director"), Position = 3) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Director"), Position = 4) = 0, ForAll(Sequence(3), Collect(Jobs, { JobFamily: "Director", Department: Dropdown3.Selected.Value, Position: 1})),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Director"), Position = 2) = 0 && CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Director"), Position = 3) = 0, ForAll(Sequence(2), Collect(Jobs, { JobFamily: "Director", Department: Dropdown3.Selected.Value, Position: 1 })),
     CountIf(Filter(Jobs, Department = Dropdown3.Selected.Value && JobFamily = "Director"), Position = 2) = 0, Collect(Jobs, {JobFamily: "Director", Department: Dropdown3.Selected.Value, Position: 1})
    
    );
    

     

     

     

    DashboardQuality.png
    DashboardLegal.png
    DashboardHR.png
  • CristianR Profile Picture
    8 on at

    Thank you @JR-BejeweledOne this looks great. I really appreciate all the time and effort you put into building this app and on explaining step by step what each piece of code does. The ideas that you gave me helps me advance with the app.

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

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard