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 / Need help to find the ...
Power Apps
Answered

Need help to find the right formula for a piechart and sharepoint list with column choice

(0) ShareShare
ReportReport
Posted on by 13

Hello everybody,

 

I have a sharepoint list with some columns.

 

Name of the Sharepoint list: 'Dashboard Atelier'

The choice column name is: 'Statutdelapr_x00e9_paration' (I'm french, and I use some accents on many word, that's why I have this name for my choice column). This column has 3 choices:

-Approved

-In progress

-Finished

 

I have another text column: 'modele'

 

I would like to make a piechart to display the total number of each choices (Approved, In progress, Finished)

 

I have ever try to test some formula but it doesn't work:

 

ForAll(Choices("Dashboard Atelier".Statutdelapr_x00e9_paration) As A,{Number:CountIf(ForAll("Dashboard Atelier",ThisRecord.Statutdelapr_x00e9_paration.Value) As B,B.Value=A.Value),Value:A.Value})

 

AddColumns(GroupBy(AddColumns('Dashboard Atelier', "Statusvalue", Statutdelapr_x00e9_paration.Value), "Statusvalue", "GroupData"), "Count", CountRows(GroupData))

 

Can someone point me in the right direction please?

 

Thank you 🙂

Categories:
  • Tolu_Victor Profile Picture
    197 Super User 2024 Season 1 on at

    Hi
    If I understand correctly you want to display a Pie chart that shows all possible statuses and the respective number of records for each status

    To do this, the easiest way would be to first collate your data, probably onVisible of your screen or onStart of your app and then simply add the collated data to your Pie Chart


    Data Collation Code:

     

    ClearCollect(coll_StatusCollation);
    ForAll(
    	Distinct('Dashboard Atelier','Statutdelapr_x00e9_paration') As currentRecord,
    	//gets all distinct statuses
    
    	Collect(
    		coll_StatusCollation,
    		{
    			StatusLabel: Text(currentRecord.'Statutdelapr_x00e9_paration'),
    			StatusCount: CountRows(Filter('Dashboard Atelier', 'Statutdelapr_x00e9_paration' = currentRecord.'Statutdelapr_x00e9_paration'))
    		}
    
    	)
    );

     

     

    On the piechart, add your collection as the Item
    Set Labels to "StatusLabel"
    Set Series to "StatusCount"


    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • GuillaumeM85 Profile Picture
    13 on at

    Hello,

     

    Thank you for your answer.

     

    I don't understand your "Clear(coll_StatusCollation)" on the first line

     

     

  • Tolu_Victor Profile Picture
    197 Super User 2024 Season 1 on at

    My bad
    It should be ClearCollect

    We need it to refresh the collection each time

     

  • GuillaumeM85 Profile Picture
    13 on at

    I've supposed that was ClearCollect 😉

    But when I copy/past your code on the OnVisible of Myscreen, it doeesn't work

    Capture d’écran 2022-12-07 164201.png
  • Verified answer
    GuillaumeM85 Profile Picture
    13 on at

    Finally, I found the right formula:

     

    AddColumns(
    GroupBy(
    AddColumns('Dashboard Atelier';"Statutpreparation";'Statut de la preparation'.Value);
    "Statutpreparation";
    "GroupData"
    );
    "CountByStatut";
    CountRows(GroupData)
    )

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 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard