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 / Error using CountRows ...
Power Apps
Answered

Error using CountRows of a list

(0) ShareShare
ReportReport
Posted on by 64

I'm trying to check if a value (which comes from a Variable) exists in a SP List.

I tried this, and returned true (I don't know if I used the correct syntax, but it worked!):

 

If(!IsBlank(LookUp('SPList', Variable = Column,"*"&Variable&"*"))

 

Now I'm trying to count rows if contains the Variable, but returns 0:

 

CountRows(Filter('SPList', Column = "*"&Variable&"*"))

 

How can I workaround that?

Categories:
I have the same question (0)
  • C-Papa Profile Picture
    1,836 on at

    Hi, what you have should work, are you trying to use wild cards though? e.g. "*"? does you data actual contain * e.g. "*MyValue*"

     

    the below works for me but this will return a number so you would need to put it in a text property to view it

    CountRows(Filter('SPList', Column = Variable))

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @gasilva8 

    For the first formula, you can use the following a little more easily:

    If(!LookUp('SPList', Variable = Column,"*" & Variable & "*", true), ... )

    In this case, LookUp will return true if the record exists.

     

    Since CountRows is not delegable, it seems to sometimes ignore itself.

    Try the following for your second formula:

    With({_data: Filter('SPList', Column = "*" & Variable & "*")}
     CountRows(_data)
    )

     

    I hope this is helpful for you.

  • C-Papa Profile Picture
    1,836 on at

    Just to add to @RandyHayes, i think you missed a comma,

     

    With({_data: Filter('SPList', Column = "*" & Variable & "*")},
    CountRows(_data)
    )

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @C-Papa 

    Yes, thank you...missed a comma.  Not unusual when typing in formulas freehand.

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
WarrenBelz Profile Picture

WarrenBelz 396 Most Valuable Professional

#2
11manish Profile Picture

11manish 134 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 101 Super User 2026 Season 2

Last 30 days Overall leaderboard