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 / PieChart with AddColum...
Power Apps
Answered

PieChart with AddColums and groupby but how to add filter?

(0) ShareShare
ReportReport
Posted on by 103

Hi,

Today I manage to create a pie chart using the below formula:

AddColumns(GroupBy(Table1,"CarModel","Status"),"CountStatus",CountRows(Status))

 

It groups the object from my Excel Table1 from CarModel and displays all carmodels into the chart.

If I would like to only select cars with the model Tesla and Audi how can I add that filter into the mix?

 

If I would like to take it a bit further and only select cars from a certain region meaning I also have to look into the Region column of the file for example Europe? How can that be accomplished?

 

Thanks!!!

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    Hi @fiddlerx ,

    This should do it

    AddColumns(
     GroupBy(
     Filter(
     Table1,
     CarModel = "Audi" || CarModel = "Tesla"
     ),
     "CarModel",
     "Status"
     ),
     "CountStatus",
     CountRows(Status)
    )

     

    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

  • fiddlerx Profile Picture
    103 on at

    Follow-up question.

    If I would like to use that for a line chart with sales of each model over time, how could that look like?

     

    If I throw a Week datacolumn into the mix so display the various series of models sales figures per week?

  • WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    @fiddlerx ,

    If the field is included, it would be available in the data available for the chart if that is your question.

  • fiddlerx Profile Picture
    103 on at

    Well. im not sure...I cant just add an excel file to the chart and select label and series it seems.. not sure why.

     

    With some help I have managed to get all the sales displayed in 1 line in the chart.

    If I would like to separate the total sales into different lines in the chart to display the car model sales per week.

    example:

    Week 1: Audi 2 sales and Tesla 4 sales

    Week 2: Audi 3 sales and Tesla 5 sales

     

    From what I understand I have to build his with addcolumns, not sure if its due to the fact that it reads from an excelsheet, using the carmodel example again:

     

    From what I can see I cannot just add City into the Table filter...

     

    CityWeekCarModel
    Stockholm1Audi
    New York1Audi
    Sydney3Tesla

     

    Sort(
    AddColumns(
    GroupBy(
    Filter(
    Table1,
    'Week' = "1" && Year = "2023" ||
    'Week' = "2" && Year = "2023" ||
    'Week' = "3" && Year = "2023"


    ),
    "Week",
    "Count"
    ),
    "CountStatus",
    CountRows(Count)
    ),
    Value('Week'),
    SortOrder.Ascending
    )

  • WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    @fiddlerx ,

    Your initial question was broad and did not describe what "over time" meant, however you could also add a column to your data set with this value (as well as the AddColumns calculation you have posted)

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard