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 / why does this put the ...
Power Apps
Answered

why does this put the new variable names in reverse?

(0) ShareShare
ReportReport
Posted on by 219

In this sample below... I am trying to create 2 new variables...
Count and CountPending
the count is a new column that is created that is the sum of the seats requested where ticketstatusid=1
the countpending is a new column where the seats requested does not equal 1.

the counts are working and a new collection is created but the value for variable name count is associated with the values for the countpending filter and vice versa.
I thought the syntax was addcolumns(table, col1, formula, col2, formula)

 

ClearCollect(TicketRequestCounts,DropColumns(AddColumns(GroupBy('Ticket Request',"EventId","GroupedItems"),"Count",Sum(Filter(GroupedItems,TicketStatusId=1),'Seats Requested'),"CountPending",Sum(Filter(GroupedItems,TicketStatusId <> 1),'Seats Requested')),"GroupedItems"));

 

I'm sure this is something obvious but I'm pretty cross eyed at this point....any thoughts?
If anyone has any ideas for improving the formula let me know please.

Categories:
  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @sasrsc1966

    Firstly, you might consider calling Count something else as it is a Reserved Word in Power Apps, however your syntax

     

    ClearCollect(
     TicketRequestCounts,
     DropColumns(
     AddColumns(
     GroupBy(
     'Ticket Request',
     "EventId",
     "GroupedItems"
     ),
     "Count",
     Sum(
     Filter(
     GroupedItems,
     TicketStatusId=1
     ),
     'Seats Requested'
     ),
     "CountPending",
     Sum(
     Filter(
     GroupedItems,
     TicketStatusId <> 1
     ),
     'Seats Requested'
     )
     ),
     "GroupedItems"
     )
    )

    should get the desired result. I assume TicketStatusId is numeric? If so you could use >1 rather than <>1, but I don't think that is the issue.

     

    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.

  • Verified answer
    sasrsc1966 Profile Picture
    219 on at

    Ignore please this is actually correct - it would help if I knew my own data. At least above someone has an example of how to do it 😉

  • sasrsc1966 Profile Picture
    219 on at

    Thanks Warren (Mr Power Apps guru)... yes, I'll do that. sorry for wasting your time on this one.. 

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

    No problems @sasrsc1966 ,

    Just one thing you might consider in future when posting code, use Format Text and post it in a code box as in my post - it makes it much easier to read and correct if necessary.

  • sasrsc1966 Profile Picture
    219 on at

    Thanks for the tip Warren...always trying to better myself.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard