cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kubo
Helper I
Helper I

Strange behavior when using AddColumns

Hello everyone,

 

I got really strange behavior here, maybe someone can explain what is happening?

Basically following formula works only if there is "Lower"  but it does not matter in which part? If I remove "Lower" from both emails, formula stop working. I'm using similar formula in other places and it works fine without "Lower", this happens only when used with "AddColumns".

WORKS:
 

 

AddColumns(
      SPlist1,
      "SortField1",
        CountRows(Filter(Sort(SPlist2,ID,Descending), 
Lower(List1Person.Email) = List2person.Email))

 


WORKS:

 

AddColumns(
      SPlist1,
      "SortField1",
        CountRows(Filter(Sort(SPlist2,ID,Descending), 
List1Person.Email = Lower(List2person.Email) ))

 


DOES NOT WORK:

 

AddColumns(
      SPlist1,
      "SortField1",
        CountRows(Filter(Sort(SPlist2,ID,Descending), 
List1Person.Email = List2person.Email))

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Kubo ,

If Delegation is your issue, you can try this

With(
   {
      wList:
      Filter(
         Sort(
            SPlist2,
            ID,
            Descending
         ), 
         StartsWith(
            List1Person.Email,
            List2person.Email
         )
      )
   },
   AddColumns(
      wList,
      "SortField1",
      CountRows(wList)
   )
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @Kubo ,

Try this - StartsWith() is not case sensitive and is a good Delegable workaround

AddColumns(
   SPlist1,
   "SortField1",
   CountRows(
      Filter(
         Sort(
            SPlist2,
            ID,
            Descending
         ), 
         StartsWith(
            List1Person.Email,
            List2person.Email
         )
      )
   )
)

 

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.

Visit my blog Practical Power Apps

 

Hi @WarrenBelz ,

Thank you for the reply.

 

That would be great workaround but for some reason I'm getting delegation warning on StartsWith this way:

"Part of this formula cannot be evaluated remotely. The 'StartsWith' function cannot be delegated if a field name appears in the second argument. Delegation warning. The "Filter" part of this formula might not work correctly on large data sets."

I have tried different way of writing the formula but cannot get rid of the warning. 

Hi @Kubo ,

Neither AllColumns() nor CountRows() are Delegable anyway (they are 'hidden" Delegation limitations), so I am assuming that is the basis of the warning (although I have not seen that one before). StartsWith() is Delegable, but the returned result needs to be under your Delegation limit or CountRows will return a partial result.

 

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.

Visit my blog Practical Power Apps

Thanks again @WarrenBelz , I'm trying to pre-filter and sort data before delegation for CountRows hits. I will use workaround for now, I have saved email addresses as a plain text in SP list and I will use this to match the columns.

Hi @Kubo ,

If Delegation is your issue, you can try this

With(
   {
      wList:
      Filter(
         Sort(
            SPlist2,
            ID,
            Descending
         ), 
         StartsWith(
            List1Person.Email,
            List2person.Email
         )
      )
   },
   AddColumns(
      wList,
      "SortField1",
      CountRows(wList)
   )
)

 

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.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @Kubo ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Visit my blog Practical Power Apps

Thank you very much @WarrenBelz , that helped a lot! 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,490)