cancel
Showing results for
Did you mean:

## Counting a total from numbers in a Sharepoint list

Hi,

I have a Sharepoint list where a column (text) has a numeric value (e.g 2) in it.

How do I show the totalt number for the current user?

The Data:

User A - 1 day

User A - 2 days

User B - 1 day

Result:

User A = 3 days

User B = 1 day

Background

I'm building a Leave-app and I want to show (to the current user) the total number of Leave days he/she has got approved on the current year.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

Looking at your screenshot, it doesn't look like your days column is in the format "X Days" so try the following formula instead

``Sum(ForAll(Filter(LedighetV2, UPN = varUser.UserProfile.userPrincipalName), Value('Antal dagar')), Value)``

Essentially just removing the whole "Left" formula.

And if your days column is already formatted as a number, you should be able to further simplify to the below.

Sum(Filter(LedighetV2, UPN = varUser.UserProfile.userPrincipalName), 'Antal dagar')

10 REPLIES 10

So if you're storing usernames, you could try something like the following.

Count(Value(Filter(MyData, user = User().FullName).DaysColumn))

Multi Super User

Please try the below to genarate your collection that displays user , sum of days:

You add this formula on the visible of your screen or on the start property of your application

// Where CC  the your User Column name

ClearCollect(list2,GroupBy(list1,"User","UserGroup"));

User Group is your grouping name you can use as it is

//SUM is the new sum column that will be displayed on list3

//DAYS is the Days Column in your list

list3 can be used now as your table datasource.

If this post helps you with your problem, please mark your as Accepted solution.

If you like my response, please give it a Thumbs Up.

MG (Naturally Curious)

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

Hi @Slaverty,

Sorry, that didn't work.

I got the following error message:

Hi @Mira_Ghaly,

I'm sorry but I don't fully understand.

-What is "User"?

"ClearCollect(list2,GroupBy(list1,"User","UserGroup"));"

-What should "UserGroup" be? Is it something from my Sharepoint List?

Apologies, I had hoped "Value" would have ignored the "Days" section of your column but I see from my own testing this is not the case.

Also, I shouldn't have used "Count", "Sum" would be required instead.

I have tested the below and it is working with the following assumptions - The usernames stored in your table match exactly the usernames of the logged in user, and secondly, your days column is all in the format "X Days" (*Number* space "Days")

``Sum(ForAll(Filter(YourData, Username = varCurUser), Value(Left(DaysColumn, Find(" ", DaysColumn)))), Value)``

I think you already know this based on your last reply, but to get the "varCurUser" I used "Set(varCurUser, User().FullName)"

Hi @Slaverty,

Thank you! It looks better. That works but I got nothing in return:

I should get " 1 " now. At least until I filter only on the "Approved"

@Slaverty wrote:

I think you already know this based on your last reply, but to get the "varCurUser" I used "Set(varCurUser, User().FullName)"

Yes, my varUser is my variable that contains information on the current logged in user such as UPN, Displayname, Manager, Direct reports etc etc 🙂

Hi,

Looking at your screenshot, it doesn't look like your days column is in the format "X Days" so try the following formula instead

``Sum(ForAll(Filter(LedighetV2, UPN = varUser.UserProfile.userPrincipalName), Value('Antal dagar')), Value)``

Essentially just removing the whole "Left" formula.

And if your days column is already formatted as a number, you should be able to further simplify to the below.

Sum(Filter(LedighetV2, UPN = varUser.UserProfile.userPrincipalName), 'Antal dagar')

Hi @Slaverty,

Ah, yes. The column only contains a number and the column is in text format (for now).

Both worked, Thank you so much for your help!

Cheers

Post Prodigy

Hi @Slaverty ,

I have two lists,

1) LeaveReQuets (List A)
2) EmployeeLeaveBalance (List B)

both list contains a Same column (Which is Person or Group) EmployeeName,

Now, I want to show the Number Column Value from List B in the label in PowerApps, by comparing the two person fields.

While Annual Balance is the Number Coloumn, I want to show the number in the Label.

Any IDea??

Announcements

#### Take a short Community User Survey | Help us make your experience better!

To ensure that we are providing the best possible experience for Community members, we want to hear from you!    We value your feedback! As part of our commitment to enhancing your experience, we invite you to participate in a brief 15-question survey. Your insights will help us improve our services and better serve the community.   👉 Community User Survey    Thank you for being an essential part of our community!    Power Platform Engagement Team

#### Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

#### Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!