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 / Sorting a column chart...
Power Apps
Answered

Sorting a column chart with custom colors

(0) ShareShare
ReportReport
Posted on by 6

Hi,

I have an app that I've set up for the Steptember challenge at work.  Everything works fine except for the column chart that I'm using to display total steps throughout the month.  I have this sorted by first name ascending...

 

Items:

SortByColumns(Steptember,"FirstName",Ascending)

 

What I want to do is display the person's team color for their bar on the graph. 

 

The below works fine provided I don't sort the data as above...

 

ItemColorSet:

ForAll(
Steptember,
Switch(
Team.Value,
"Tahi", RGBA(255, 156, 58, 1),
"Rua",RGBA(189, 55, 128, 1),
"Toru", RGBA(6, 181, 255, 1),
"Whā",RGBA(108, 164, 99, 1),
Color.Gray))

 

DanNZ1_0-1662161167576.png

 

With the sort by first name in place the colors no longer correspond to the correct person...

 

DanNZ1_1-1662161339844.png

 

How do I incorporate the requirement to sort by first name into ItemColorSet?

 

Thanks in advance for any assistance offered.

Categories:
  • jatcube Profile Picture
    508 on at

    @DanNZ1 can you try adding the ThisRecord property as such?

    ForAll(
    Steptember,
    Switch(
    ThisRecord.Team.Value,
    "Tahi", RGBA(255, 156, 58, 1),
    "Rua",RGBA(189, 55, 128, 1),
    "Toru", RGBA(6, 181, 255, 1),
    "Whā",RGBA(108, 164, 99, 1),
    Color.Gray))
  • DanNZ1 Profile Picture
    6 on at

    Thanks.  Just tried that and it didn't make any difference unfortunately.

  • Verified answer
    jatcube Profile Picture
    508 on at

    Oh I see @DanNZ1, I didn't notice, try this

    ForAll(
    SortByColumns(Steptember,"FirstName",Ascending),
    Switch(
    ThisRecord.Team.Value,
    "Tahi", RGBA(255, 156, 58, 1),
    "Rua",RGBA(189, 55, 128, 1),
    "Toru", RGBA(6, 181, 255, 1),
    "Whā",RGBA(108, 164, 99, 1),
    Color.Gray))

    This should work since the order of the rows needs to match in items and the ItemColorSet as well for colors to be added properly.

     

    Alternatively, you could just do a ClearCollect with the sorting in place and simply reference the sorted collection in both places. hope this helps.

     

  • DanNZ1 Profile Picture
    6 on at

    Thank you!  That worked!

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard