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 / adding a second column...
Power Apps
Unanswered

adding a second column using AddColumns not working - new column does not show up to select.

(0) ShareShare
ReportReport
Posted on by 273

I have an AddColumns that works fine with a Collection

selectedStoreSalesOverTime

(the first column shown below). But if I add a second column, it is parsed correctly in the designer (no errors) but the added column doesn't show up as a selectable series in the designer. Am I missing something? 

 

AddColumns(
 selectedStoreSalesOverTime,
 "SalesDay",
 Switch(
 Text(Weekday(DayOfInsert)),
 "1",
 "Sun",
 "2",
 "Mon",
 "3",
 "Tue",
 "4",
 "Wed",
 "5",
 "Thu",
 "6",
 "Fri",
 "7",
 "Sat"
 ),
 "sales_formatted",
 Text(
 daily_sales_figure,
 "[$-en-US]$###,###"
 )
)
Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @JamesM,

    Your formula looks correct. What if you change the order?

    AddColumns(
     selectedStoreSalesOverTime,
     "sales_formatted",
     Text(
     daily_sales_figure,
     "[$-en-US]$###,###"
     ),
     "SalesDay",
     Switch(
     Text(Weekday(DayOfInsert)),
     "1",
     "Sun",
     "2",
     "Mon",
     "3",
     "Tue",
     "4",
     "Wed",
     "5",
     "Thu",
     "6",
     "Fri",
     "7",
     "Sat"
     )
    )
  • timl Profile Picture
    37,212 Super User 2026 Season 1 on at

    Hi James,
    Where exactly are you calling the AddColumns function?
    Ideally, you should be setting the Items property of a data control to the result of the AddColumns function because unless you do this, the function might not work as you expect.
    The AddColumns can add a column to a collection, but it *doesn't* modify the source collection. If you want to modify the source collection, you would need to collect the result of the AddColumns function back into the source collection. Therefore, if you were calling AddColumns from the OnVisible property of a screen, you would need to use syntax that looks like this.

    ClearCollect(
    selectedStoreSalesOverTime,
    AddColumns( selectedStoreSalesOverTime, "SalesDay", Switch( Text(Weekday(DayOfInsert)), "1", "Sun", "2", "Mon", "3", "Tue", "4", "Wed", "5", "Thu", "6", "Fri", "7", "Sat" ), "sales_formatted", Text( daily_sales_figure, "[$-en-US]$###,###" ) )
    )



     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @timl,

    Sometimes I like to use it as @JamesM did to add a formatted column to a datatable where the underlying source isn't formatted as I wish to display it in the datatable. Then I simply uncheck the old value and check the new one. There is no need to collect it then.  However, if he is creating a collection anyway, it can be included in the original Collect() function.  I'm still not sure why his formula didn't work though.

  • timl Profile Picture
    37,212 Super User 2026 Season 1 on at

    Thanks for that @Drrickryp On re-reading the original post, I see that I was probably wrong in my hypothesis that James was calling AddColumns from somewhere like OnVisible, given that adding a single column works. It'll be interesting to see what happens when James reverses the order. Hopefully, it'll shed a bit more light on what might be wrong.

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 431

#2
WarrenBelz Profile Picture

WarrenBelz 360 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 280 Super User 2026 Season 1

Last 30 days Overall leaderboard