cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cpolito
Helper I
Helper I

Building Charts

I have a table with 5 columns  Employee Number (text), approved_count (int), locked_count (int) ,unlocked_count (int), posted_count (int).

 

I want to display this in either a  column or pie chart  by employee number in a gallery.

every row in the gallery represents one set.

 

I want a chart in each gallery row to show each count.

This should be extremely easy. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@cpolito 

You can use the GroupBy function in your Items formula for your chart for this (along with some AddColumns and DropColumns).

Something like this formula:

DropColumns(
    AddColumns(
        GroupBy(yourDataSource,
            "Employee Number", 
            "records"
        ),
        "ApproveCount", Sum(records, approved_count),
        "LockedCount", Sum(records, locked_count),
        "UnlockedCount", Sum(records, unlocked_count),
        "PostedCount", Sum(records, posted_count)
    ),
    "records"
)

 

This will provide a table of records with each employee ID and a Sum of the corresponding counts for each.

The DropColumns is optional, but usually the underlying records are not needed for a chart, so in this case I drop them.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@cpolito 

You can use the GroupBy function in your Items formula for your chart for this (along with some AddColumns and DropColumns).

Something like this formula:

DropColumns(
    AddColumns(
        GroupBy(yourDataSource,
            "Employee Number", 
            "records"
        ),
        "ApproveCount", Sum(records, approved_count),
        "LockedCount", Sum(records, locked_count),
        "UnlockedCount", Sum(records, unlocked_count),
        "PostedCount", Sum(records, posted_count)
    ),
    "records"
)

 

This will provide a table of records with each employee ID and a Sum of the corresponding counts for each.

The DropColumns is optional, but usually the underlying records are not needed for a chart, so in this case I drop them.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you.  That did it.. I was wondering why I was only getting one series to show.. Found the # of series in the advanced.. Thanks again!

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,895)