web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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:
I have the same question (0)
  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard