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 / Sum of added column
Power Apps
Answered

Sum of added column

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, So i have a data table which i have to add a number of extra columns to. One being a percentage of the score vs the potential score. I now want a sum of the filtered data table (so it only shows the sum for that month for that agent) but i can not work it out I have tried, but it doesnt work: 

 

Sum(Filter(Table1, Agent ' = Dropdown2.Selected.'Agent Name ', Label4.Text = Text(MonthStats)), Percentage)

 

This is the formula in the data table: 

Filter(AddColumns(AddColumns(Table1, "MonthStats", Text(Month(Date_x0020_)), "FormattedDate", Text(Date_x0020_, "[$-en-GB]dd/mm/yyyy"), "Score", If('Did the response resolve their enquiry?'= "Yes", 10, 0), "PotentialScore", 10),"Percentage", Sum((Score / PotentialScore)*100)),'Agent ' = Dropdown2.Selected.'Agent Name ', Label4.Text = Text(MonthStats))

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    The issue is that the DataTable does not serve as a datasource.  Galleries have an AllItems property which can be used in this way, but DataTables do not.  Therefore, you will not have access to your added columns outside of the table.

     

    What I would recommend is to create a collection with the formula you have.  You can place this in the OnVisible action or some other place as you see fit - perhaps needed in your OnChange of the Agent dropdown.

     

    ClearCollect(colMyData, 
    Filter(
    AddColumns(
    AddColumns(Table1,
    "MonthStats", Text(Month(Date_x0020_)),
    "FormattedDate", Text(Date_x0020_, "[$-en-GB]dd/mm/yyyy"),
    "Score", If('Did the response resolve their enquiry?'= "Yes", 10, 0),
    "PotentialScore", 10
    ),
    "Percentage", Sum((Score / PotentialScore)*100)
    ),
    'Agent ' = Dropdown2.Selected.'Agent Name ', Label4.Text = Text(MonthStats)
    )
    )

    Then set your datatable items to colMyData

    Now you can use that collection in your sum formula:

     

    Sum(colMyData, Percentage)

    By the way - in this formula, we're not filtering by agent or month because the collection is already filtered by that.

     

    I hope this is helpful for you.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    That is exactly what i was after I thought it would need a collection somewhere but couldnt work out how that would work with me changing the dropdowns all the time but on change for both dropdowns works perfectly! Thanks 

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 414

#2
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard