Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Getting a Count Badge if there rows in another list

I have 2 lists, 

- Assets

- Assets_Maint (Maintenance)


In my powerapp I want to put a little badge with the number of open issues that item has right in the gallery.  I already have it designed but I can't figure out what I am doing wrong when it comes to getting to row count. This is what I am using right now:

CountRows(LookUp('Assets_Maint', 'Asset_SN'= ThisItem.'Serial number'))


This should be going to the Asset Maintenance list and counting all the rows that have the same serial as "ThisItem" in the gallery.  But it fails and the diagnostics are not clear on what is wrong.  Any help?

Super User
Super User

Use Filter rather than LookUp.


Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.


I found 2 things that I forgot to add to the post.

1. The Asset_SN is a lookup field in Lists.  So i needed to all ".Value" to it to get the value.  Sadly that didn't Fix it.

2. I tried your suggestion with the below code and it returns a "Cannot use table contents in this context":

CountRows(Filter('Assets_Maint','Asset_SN'.Value in ThisItem.'Serial number'))


So far no luck.

Super User
Super User

Can you show me what this returns when you add it to a collection:

ClearCollect(TestCollection, LookUp('Assets_Maint','Asset_SN'.Value in ThisItem.'Serial number'))

Its an empty collection:

Screenshot (10).png

And it says there are "Invalid Arguments"

Can you show me a screenshot of the formula where it is highlighting the invalid arguments?


Screenshot (14).png

Screenshot (11).png

Super User
Super User

CountRows(Filter('Assets_Maint','Asset_SN'.Value in ThisItem.'Serial number'))

Does this show an error? I have tried to mock something similar and it is working. Just to be sure 'Asset_SN', what data type should this be returning?

Helpful resources

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,679)