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 / How to set the bar wid...
Power Apps
Answered

How to set the bar width let them scale to fit the gallery

(0) ShareShare
ReportReport
Posted on by 109

Hi guys,

I create some bar in gallery which length is depending on 'sum of value'. My gallery width value is 640. So it will exceed the gallery width. I want all of the other bar sizes to be a ratio of that maximum size, based on 'sum of value'.

未命名3.png

Categories:
  • kit1128 Profile Picture
    109 on at

    Need Help~~

  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @kit1128 

    To do this you would need to create a collection.  Put this code in the OnVisible property of your screen. 

    ClearCollect(
     myProjects,
     DropColumns(
     AddColumns(
     GroupBy(Filter(ETimeSheetMain, Title = UserMail),"Project","GroupedProjects"),
     "Sum of Value",Sum(GroupedProjects,WorkingHours)
     ),
     "GroupedProjects"
     )
    )

     

    Replace the code in the Items property of Gallery1 with this.

    myProjects

     

    Finally, use this code in the Width property of your bar.

    (ThisItem.'Sum of Values'/Max(myProjects,'Sum of Value'))*Gallery1.Width

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • kit1128 Profile Picture
    109 on at

    @mdevaney ,

    OMG, thank you so so so much!! You helped me a lot, you're awesome dude.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @kit1128 

    It was an interesting problem.  I'm glad I could help 🙂

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 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard