web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / AddColumns not working
Power Apps
Unanswered

AddColumns not working

(1) ShareShare
ReportReport
Posted on by 216
I have created this collection in my app:
ClearCollect(colAssetsTotal,
    AddColumns(GroupBy(colAllEquipment, phase, equipment, GroupedByItem),  
        EquipmentSum, Sum(GroupedByItem, WeightedCompleted*100),
        PhaseWeighting, Switch(phase, "Design Data", 0.4, "Fabrication Data", 0.2, "As-Built Data", 0.3, "Commissioning Data", 0.1)))
 
 
What I want to do is add a column to the collection which multiplies EquipmentSum by PhaseWeighting.
If I try to add the column within the AddColumns statement, then it doesn't recognise the two columns previous to it.
If I add a new AddColumns like below, then I get an error that the new column name has already been used.
I've tried different names and the error is the same.
The last thing I tried was to use the AddColumns formula outside of the ClearCollect and after it.
No errors with this, but the column doesn't show in my table after running and can't be referenced.
Do I need a With statement to get this to work?
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at
    Hi CAlvy
    You need to do this
    ClearCollect(
       colAssetsTotal,
       AddColumns(
          AddColumns(
             GroupBy(
                colAllEquipment, 
                phase, 
                equipment, 
                GroupedByItem
             ),  
             EquipmentSum, 
             Sum(
                GroupedByItem, 
                WeightedCompleted * 100
             ),
             PhaseWeighting, 
             Switch(
                phase, 
                "Design Data", 
                0.4, 
                "Fabrication Data", 
                0.2, 
                "As-Built Data", 
                0.3, 
                "Commissioning Data", 
                0.1
             )
          ),
          SumWeight,
          EquipmentSum * PhaseWeighting
       )   
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard