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 values from differ...
Power Apps
Answered

Sum values from different columns based on another columns value

(0) ShareShare
ReportReport
Posted on by 181

 

Hi all,

 

I have a Project Management list where every project has a StartYear and a StopYear. From that I have set columns with the actual year, and the actual budget. See figure.


Budget data.png

 

Now want to add the yearly project budget for a certain year to each other to see our total project volume year by year.

I would like to have a Collection with five columns which starts with current year and e.g four years ahead.

Does anyone have a smart solution for this?

 

Best,
Lennart

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at

    Hi @LennartWalldén ,

    Something like this in a Gallery Items should work

    AddColumns(
     GroupBy(
     YourListName,
     "StartYear",
     "YearBudget"
     ),
     "BudgetTotal",
     YearBudget.BudgetYear1 + 
     YearBudget.BudgetYear2 + 
     YearBudget.BudgetYear3 +
     YearBudget.BudgetYear4 + 
     YearBudget.BudgetYear5
    )
     

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • LennartWalldén Profile Picture
    181 on at

    Hi @WarrenBelz,

     

    Thanks for your reply.

    I am sorry, but I don't think I made myself clear in the previous post. The result I want is the sum of the actual years yearly budget from each project.

    So for example, if we look at 2020 and the figure, the result should be:
    Project1.BudgetYear3+Project2.BudgetYear2+Project3.BudgetYear1+Project4.BudgetYear1+Project5.BudgetYear2.

     

    Do you see what I mean? 🙂

     

    Best,

    Lennart

     

     

  • WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at

    @LennartWalldén ,

    A job for a spreadsheet I think - nothing I can think of sorry. Someone else may want to attempt it.

  • LennartWalldén Profile Picture
    181 on at

    Hi @WarrenBelz ,

     

    Thanks for your reply. In some way it feels good that I'm not the only one who can't figure this out 🤔, and I assume that if you can't it's more or less impossible. I will try to have some conversation between a spreadsheet and my app, as you suggested.

    Thanks anyhow for your attempt!😊

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @LennartWalldén ,

    Does your original table looks like this?

    72.PNG

     

    Do you want a table that looks like this?

    721.PNG

     

    Could you tell me the data type of the fields in original table?
    I assume that except projectname field, others are all number type.

    If so, try this formula to create this kind of collection:

    ClearCollect(yearlybudget,
    {Year:Year(Today()),
    Totalproj:Sum(Filter('Project Management',Year1=Year(Today())),BudgetYear1)+
     Sum(Filter('Project Management',Year2=Year(Today())),BudgetYear2)+
     Sum(Filter('Project Management',Year3=Year(Today())),BudgetYear3)+
     Sum(Filter('Project Management',Year4=Year(Today())),BudgetYear4)+
     Sum(Filter('Project Management',Year5=Year(Today())),BudgetYear5)},
    {Year:Year(Today())+1,
    Totalproj:Sum(Filter('Project Management',Year1=Year(Today())+1),BudgetYear1)+
     Sum(Filter('Project Management',Year2=Year(Today())+1),BudgetYear2)+
     Sum(Filter('Project Management',Year3=Year(Today())+1),BudgetYear3)+
     Sum(Filter('Project Management',Year4=Year(Today())+1),BudgetYear4)+
     Sum(Filter('Project Management',Year5=Year(Today())+1),BudgetYear5)},
    {Year:Year(Today())+2,
    Totalproj:Sum(Filter('Project Management',Year1=Year(Today())+2),BudgetYear1)+
     Sum(Filter('Project Management',Year2=Year(Today())+2),BudgetYear2)+
     Sum(Filter('Project Management',Year3=Year(Today())+2),BudgetYear3)+
     Sum(Filter('Project Management',Year4=Year(Today())+2),BudgetYear4)+
     Sum(Filter('Project Management',Year5=Year(Today())+2),BudgetYear5)},
    {Year:Year(Today())+3,
    Totalproj:Sum(Filter('Project Management',Year1=Year(Today())+3),BudgetYear1)+
     Sum(Filter('Project Management',Year2=Year(Today())+3),BudgetYear2)+
     Sum(Filter('Project Management',Year3=Year(Today())+3),BudgetYear3)+
     Sum(Filter('Project Management',Year4=Year(Today())+3),BudgetYear4)+
     Sum(Filter('Project Management',Year5=Year(Today())+3),BudgetYear5)},
    {Year:Year(Today())+4,
    Totalproj:Sum(Filter('Project Management',Year1=Year(Today())+4),BudgetYear1)+
     Sum(Filter('Project Management',Year2=Year(Today())+4),BudgetYear2)+
     Sum(Filter('Project Management',Year3=Year(Today())+4),BudgetYear3)+
     Sum(Filter('Project Management',Year4=Year(Today())+4),BudgetYear4)+
     Sum(Filter('Project Management',Year5=Year(Today())+4),BudgetYear5)}
    )
    
    
    

     

     Best regards,

  • LennartWalldén Profile Picture
    181 on at

    Hi @v-yutliu-msft ,

    Thanks a lot, it worked like a charm! 😄

     

    Best,

    Lennart

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard