cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ahmad-KAISPE
Helper V
Helper V

Pie Chart from SharePoint List

Hi all,

I have share point list with different questions which contains form survey results for example:

Q1                               Q2                            Q3                         Q4
Agree                          Disagree                   Strongly Agree     Strongly Disagree
Strongly Agree           Strongly Disagree     Disagree               Agree

 

What I want is to summarize my response result (in percentage) which contains these answers?

 

Can someone please help on this?

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @Ahmad-KAISPE ,

Do you want to show the percentage based on all the results? Like your example, show the percentage based on 8 results? If so, I did a test on my side, you can refer to my steps:

1. This is my list called “list8”:

v-albai-msft_0-1616133348002.png

2. Go to the app, set OnStart property of App to below. This will create a collection to keep all the results into a one-column- table. Then count the percentage based on this table.

ClearCollect(collist,list8);
ClearCollect(colresults,
Split(Left(Concat(collist,Question1&", "&Question2&", "&Question3&", "&Question4&", "),
Len(Concat(collist,Question1&", "&Question2&", "&Question3&", "&Question4&", "))-2),
   ", "
));
ClearCollect(colchart,
Table(
    {Result:"Agree",Number:CountRows(Filter(colresults,Result="Agree"))/CountRows(colresults)},
    {Result:"Disagree",Number:CountRows(Filter(colresults,Result="Disagree"))/CountRows(colresults)},
    {Result:"Strongly Agree",Number:CountRows(Filter(colresults,Result="Strongly Agree"))/CountRows(colresults)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(colresults,Result="Strongly Disagree"))/CountRows(colresults)}
    )
    )

v-albai-msft_1-1616133348005.png

3. Add a pie chart, set items property of PieChart control to:

AddColumns(colchart,"percentage",Text(Number*100,"[$-en-GB]##0%"))

v-albai-msft_2-1616133348009.png

4. Set Items property of Legend control to:

v-albai-msft_3-1616133348013.png

5. Open Advanced tab of PieChart control, and select “percentage” option of Labels dropdown:

v-albai-msft_4-1616133348014.png

Check results this time:

v-albai-msft_5-1616133348016.png

If you want to show percentage for each question, you can refer to below steps:

1. Add a dropdown box for selecting question, set its Items to:

["Question1","Question2","Question3","Question4"]

v-albai-msft_6-1616133348018.png

2. Add a button to search the percentage of selected question. Set its OnSelect property to:

ClearCollect(colrecord,
Switch(Dropdown1.SelectedText.Value,
"Question1",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question1="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question1="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question1="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question1="Strongly Disagree"))/CountRows(collist)}
    ),
"Question2",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question2="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question2="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question2="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question2="Strongly Disagree"))/CountRows(collist)}
    ),
"Question3",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question3="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question3="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question3="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question3="Strongly Disagree"))/CountRows(collist)}
    ),  
"Question4",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question4="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question4="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question4="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question4="Strongly Disagree"))/CountRows(collist)}
    )   
))

3. Add a pie chart, set items property of PieChart control to:

AddColumns(colrecord,"percentage",Text(Number*100,"[$-en-GB]##0%"))

4. Set Items property of Legend control to:

colrecord.Result

5. Open Advanced tab of PieChart control, and select “percentage” option of Labels dropdown:

v-albai-msft_7-1616133348019.png

Check results this time(after selecting a question, must click search to get the results):

v-albai-msft_8-1616133348023.png

Best Regards,

Allen

View solution in original post

2 REPLIES 2
Ahmad-KAISPE
Helper V
Helper V

Any update on this thread?

Thanks

v-albai-msft
Community Support
Community Support

Hi @Ahmad-KAISPE ,

Do you want to show the percentage based on all the results? Like your example, show the percentage based on 8 results? If so, I did a test on my side, you can refer to my steps:

1. This is my list called “list8”:

v-albai-msft_0-1616133348002.png

2. Go to the app, set OnStart property of App to below. This will create a collection to keep all the results into a one-column- table. Then count the percentage based on this table.

ClearCollect(collist,list8);
ClearCollect(colresults,
Split(Left(Concat(collist,Question1&", "&Question2&", "&Question3&", "&Question4&", "),
Len(Concat(collist,Question1&", "&Question2&", "&Question3&", "&Question4&", "))-2),
   ", "
));
ClearCollect(colchart,
Table(
    {Result:"Agree",Number:CountRows(Filter(colresults,Result="Agree"))/CountRows(colresults)},
    {Result:"Disagree",Number:CountRows(Filter(colresults,Result="Disagree"))/CountRows(colresults)},
    {Result:"Strongly Agree",Number:CountRows(Filter(colresults,Result="Strongly Agree"))/CountRows(colresults)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(colresults,Result="Strongly Disagree"))/CountRows(colresults)}
    )
    )

v-albai-msft_1-1616133348005.png

3. Add a pie chart, set items property of PieChart control to:

AddColumns(colchart,"percentage",Text(Number*100,"[$-en-GB]##0%"))

v-albai-msft_2-1616133348009.png

4. Set Items property of Legend control to:

v-albai-msft_3-1616133348013.png

5. Open Advanced tab of PieChart control, and select “percentage” option of Labels dropdown:

v-albai-msft_4-1616133348014.png

Check results this time:

v-albai-msft_5-1616133348016.png

If you want to show percentage for each question, you can refer to below steps:

1. Add a dropdown box for selecting question, set its Items to:

["Question1","Question2","Question3","Question4"]

v-albai-msft_6-1616133348018.png

2. Add a button to search the percentage of selected question. Set its OnSelect property to:

ClearCollect(colrecord,
Switch(Dropdown1.SelectedText.Value,
"Question1",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question1="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question1="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question1="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question1="Strongly Disagree"))/CountRows(collist)}
    ),
"Question2",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question2="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question2="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question2="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question2="Strongly Disagree"))/CountRows(collist)}
    ),
"Question3",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question3="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question3="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question3="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question3="Strongly Disagree"))/CountRows(collist)}
    ),  
"Question4",Table(
    {Result:"Agree",Number:CountRows(Filter(collist,Question4="Agree"))/CountRows(collist)},
    {Result:"Disagree",Number:CountRows(Filter(collist,Question4="Disagree"))/CountRows(collist)},
    {Result:"Strongly Agree",Number:CountRows(Filter(collist,Question4="Strongly Agree"))/CountRows(collist)},
    {Result:"Strongly Disagree",Number:CountRows(Filter(collist,Question4="Strongly Disagree"))/CountRows(collist)}
    )   
))

3. Add a pie chart, set items property of PieChart control to:

AddColumns(colrecord,"percentage",Text(Number*100,"[$-en-GB]##0%"))

4. Set Items property of Legend control to:

colrecord.Result

5. Open Advanced tab of PieChart control, and select “percentage” option of Labels dropdown:

v-albai-msft_7-1616133348019.png

Check results this time(after selecting a question, must click search to get the results):

v-albai-msft_8-1616133348023.png

Best Regards,

Allen

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,110)