cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Creating a Pie-Chart in PowerApps

Hi.

 

I have an Excel Sheet as Data-Source, and I wanna make a pie-chart diagram out of one collumn that is in this Excel Sheet.

 

The collumn has just ratings from 1-5 (from a star-rating-system).

 

So what i wanna do now, is to create a new collumn with the AddCollumns-Function where I count the frequency of the respective rating.

 

So on the left collumn should be the rating (1-5), and on the right one the frequency. (for example 5 People rated it with a 4 -> frequency = 5)

 

I've tried a lot so far, but i can't get it to work. I played around with distinct, AddCollumns, GroupBy and some other functions.

 

 

This is how it looks when i don't do anything with it. As you can see it just takes the value of the number and adjusts the size accordingly.

 

I hope someone can help me.

Thanks in advance

 

 

Edit:

 

unknown.png

 

This is how my Excel sheet looks like.

As you can see I have an ID_presentation collumn that refers to another Excel sheet filled with presentations that can be rated. (So i know exactly what presentation got which rating)

In the collumn "rating"  are just the numbers 1-5 for the respective raiting.

Note: The Presentation with the ID 4 for example could have multiple ratings from different users that are the same (5 Stars for example)

3 REPLIES 3
Highlighted
Memorable Member
Memorable Member

Why don't you simply manually add a column into your excel presentation table with a name for example RatingSum. And everytime someone add rating into your rating table then automatically update presentation table RatingSum column with average rating result. Basically have something like this in your button for saving rating. Obviously you will have to adjust it for your needs

 

Patch(Rating_Table, Defaults(Rating_Table),{id:"1", user: "user1", rating:Rating1.Value}); 
UpdateIf(Presentation_Table, id="1",{RatingSum: Sum(Filter(Rating_Table,id="1"),rating)/CountRows(Filter(Rating_Table,id="1"))})

After that you can only link your PieChart with Presentation table and you are done

Highlighted
Power Apps
Power Apps

You are in the right track - a combination of GroupBy, AddColumns and CountRows should give you the formula that you can use for your pie chart's Items property:

AddColumns(
    GroupBy(
        YourTableName,
        "Rating",
        "ByRating"),
    "CountOfRatings", CountRows(ByRating))

You may need to update the Series and Labels property (in the advanced pane) of the pie chart to make sure that the appropriate columns are selected.

 

You can also sort the table that is passed to the pie chart to ensure that the legend will be displayed in the order of the ratings (1, 2, 3, 4, 5):

SortByColumns(
    AddColumns(
        GroupBy(
            YourTableName,
            "Rating",
            "ByRating"),
        "CountOfRatings", CountRows(ByRating)),
    "Rating",
    Ascending)

 

Highlighted

Hi @CarlosFigueira .

 

Based on your reference I tried with the below formula

AddColumns(GroupBy(KPOPageLimitEntities,"Category","ByCategory"),"CountOfCategory", Sum(ByCategory,ActualPage))

 

Attached the Datasource here:

 

Screenshot 2020-06-25 at 4.58.59 PM.png

 

Error faced: The specified column 'Category' does not exist.

 

Any idea why it is happening?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,803)