cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pygesteima
Frequent Visitor

RemoveIf self reference CountIf condition

Hi everyone!

I'm building a Powerapps that collects information from an excel file using a key (National ID) to collect all rows refering to a particular person.

Usually we get 20~40 rows per person on the collection.

Here's the on select from the collect button:

 

 

ClearCollect(col_BolxCPF,Filter(Table1;CPF=t_CPF.Text))

 

 

 

Now, I want to remove some items on the "col_BolxCPF" collection using mutiple "RemoveIF"; all of them works wonderfully except for thisone:

 

 

RemoveIf(col_BolxCPF,Status="Expired",CountIf(col_BolxCPF,Message = ThisRecord.Message,Status="Paid")>0);

 

 

It's ment to remove all tickets that have expired, and has ben paid on another ticket with the same Message.

The issue here seems to be that "ThisRecord.Message" is referencing the record on the CountIF instead of the record on the RemoveIF.

On the CountIf, when I reference "Message" im sure it's referencing the CountIf's source.

I thought that using "ThisRecord." wold reference the RemoveIf item being checked. But it doesn't. It references the CountIf Item all the same. And then

 

 

Message = ThisRecord.Message

 

 

 is allways true.

 

Does anyone know, how can I reference the "RemoveIf" item inside the "CountIf" item?

Does anyone know a better (or at least functioning) way to solve this?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MichelK
Resolver II
Resolver II

Hello @pygesteima,

You could try the following: 

RemoveIf(col_BolxCPF As BolxCPF,Status="Expired",CountIf(col_BolxCPF,Message = BolxCPF.Message,Status="Paid")>0);

 

Let me know if this helps!

View solution in original post

2 REPLIES 2
MichelK
Resolver II
Resolver II

Hello @pygesteima,

You could try the following: 

RemoveIf(col_BolxCPF As BolxCPF,Status="Expired",CountIf(col_BolxCPF,Message = BolxCPF.Message,Status="Paid")>0);

 

Let me know if this helps!

Exactly what I was looking for!

Just added the "BolxCPF" reference at "status" too, like this:

RemoveIf(col_BolxCPF As BolxCPF,BolxCPF.Status="Expired",CountIf(col_BolxCPF,Message = BolxCPF.Message,Status="Paid")>0);

 

Thank you very much! ❤️

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 (3,685)