cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marc2510
Helper III
Helper III

Calculate certain value

I have multiple columns ( Maths, English, Science) the choice are E,G,I,U

i now want to be able to calculate how many U's have been selected from the multiple choice columns (for this row of data)

i would have a multiple labels that show the calculated values for example

 

marc2510_0-1612967970990.png

E=3
G=1
I=1

U=0

 

i was hoping for somthing like this?

 

Sum(Tracker_FullData,ThisItem.Art_engagement.Value="G"+ThisItem.Eng_engagement.Value="G")

 

but as the values are letters this wont work?



1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @marc2510 

Are you using a table or a Gallery? What is your datasource?

I assume that you are using a gallery to display records from a SP list. If you have a countable number of Choice columns, you can try my method:

1. I create a list called “count1” with a “Title” column and 6 Choice columns(their choice are E,G,I,U):

v-albai-msft_0-1614067174218.png

2. Go to my app, add a button into the gallery, set its OnSelect property to(use four variables to calculate):

Set(E,0);
Set(G,0);
Set(I,0);
Set(U,0);
Switch(ThisItem.Drama.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.'D&T'.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.English.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.EngLit.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.EarlyYears.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.French.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.'Food Tech'.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1))

3. Add four labels inside/outside the gallery, then set their Text property to the four variable names in turn:

v-albai-msft_1-1614067174221.png

If you want to see the calculated values of one item, just click the button beside this item, then you can check results like below(in my test, I add another four labels to show “E=”,”G=”,”I=”,”U=”):

v-albai-msft_2-1614067174223.png

Best Regards,

Allen

View solution in original post

3 REPLIES 3
marc2510
Helper III
Helper III

Anyone? 

Can you give more information because your table does not show any number column to be added or you want to count?

if count, what column and also is the table connected to a Gallery

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

v-albai-msft
Community Support
Community Support

Hi @marc2510 

Are you using a table or a Gallery? What is your datasource?

I assume that you are using a gallery to display records from a SP list. If you have a countable number of Choice columns, you can try my method:

1. I create a list called “count1” with a “Title” column and 6 Choice columns(their choice are E,G,I,U):

v-albai-msft_0-1614067174218.png

2. Go to my app, add a button into the gallery, set its OnSelect property to(use four variables to calculate):

Set(E,0);
Set(G,0);
Set(I,0);
Set(U,0);
Switch(ThisItem.Drama.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.'D&T'.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.English.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.EngLit.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.EarlyYears.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.French.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1));
Switch(ThisItem.'Food Tech'.Value,"E",Set(E,E+1),"G",Set(G,G+1),"I",Set(I,I+1),"U",Set(U,U+1))

3. Add four labels inside/outside the gallery, then set their Text property to the four variable names in turn:

v-albai-msft_1-1614067174221.png

If you want to see the calculated values of one item, just click the button beside this item, then you can check results like below(in my test, I add another four labels to show “E=”,”G=”,”I=”,”U=”):

v-albai-msft_2-1614067174223.png

Best Regards,

Allen

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,299)