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 / Create a chart by cate...
Power Apps
Answered

Create a chart by category

(1) ShareShare
ReportReport
Posted on by 21

I want to create a bar chart in Power Apps, but I'm having typing issues.

 

 

AddColumns(
 GroupBy(Expenses, Category, gbCategory),
 Total,
 Sum(gbCategory, Value)
)

 

 

Copilot returns the following log:

 

The expression was intended to group the 'Expenses' table by the 'Category' column, create a new column named 'gbCategory' for the nested grouped data, and then calculate the sum of the 'Value' column within each group. However, the errors in the expression are that the 'GroupBy' function is being used incorrectly, and the 'Sum' function is expecting a numeric value but is receiving a table instead.

 

I believe the issue is with 'Category' since it comes from a SharePoint list of type 'Choice', so it is probably not converting to a string.

 

Is there any way to solve this?

 

Thank you for your attention.

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,242 Most Valuable Professional on at

    Hi @Gabriel_Pedri ,

    Firstly, what is the name of the column in Expenses that you are trying to sum ? Assuming it is a number column, you need to use that column name. Also you are better doing this if you want to group by a Choice field

    AddColumns(
       GroupBy(
          AddColumns(
             Expenses, 
             CatValue,
             Category.Value
          ), 
          CatValue,
          gbCategory
       ),
       Total,
       Sum(
          gbCategory, 
          YourNumberField
       )
    )
    ​​​​​​​

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 617

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard