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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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