Skip to main content
Community site session details

Community site session details

Session Id : i4hNlM976PC3lwKzV0DfBg
Power Apps - Building Power Apps
Unanswered

CountA & CountIf Counts Empty Rows?

Like (0) ShareShare
ReportReport
Posted on 26 Mar 2022 01:42:22 by 59

Hello,

 

I have a collection and within that collection I am collecting Outlook Events. I then use that collection to count how many events I have within a given week. However, if I clear the collection/delete all events, my Count functions are still seeming to return "1". I've tried using CountA as well as using CountIf with a condition that filters out blank rows in the column.

 

Neither of these were giving me the result I'm looking for. If the collection is blank or has 1 event, both of those will just return the same thing; "1".

 

Is there something I'm missing or is this not a possibility with my process? Thanks for any insight you can provide.

  • Kongol Profile Picture
    59 on 29 Mar 2022 at 01:20:58
    Re: CountA & CountIf Counts Empty Rows?

    Very appreciative of your response, sorry for all the missing info. Here is the ClearCollect:

     

    ClearCollect(
     EventCount,
     {
     Events: Office365Outlook.GetEventsCalendarViewV3(
     LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Intake Tracking").Name,
     DateAdd(_dateSelected, -Weekday(Sdate,StartOfWeek.MondayZero)),
     DateAdd(_dateSelected, 4-Weekday(Sdate,StartOfWeek.MondayZero)))
     }
    );

     This is within the onSelect property of a button. Immediately following this, I define a variable: 

    Set(Stotal, CountIf(EventCount, Not(IsBlank(Events.value.id))));

    I get the feeling it may not be working because collections never return "Blank()"? I have also tried "null", "", & 0 but none provide the result I'm looking for.

     

    This is the collection when it is completely clear of outlook events: 

    Kongol_0-1648516532514.png

    Despite this, upon selecting my button to ensure the collection is ClearCollected, my text label with variable Stotal still reads "1 out of 9". However, when I add a single event, it doesn't update. It continues to just say "1 out of 9". This is how I came to the conclusion that my CountIf is still counting empty rows. I have also tried just CountA but alas, still shows "1 out of 9" with an empty collection.

     

    Once again, truly appreciative of your help. This functionality is huge for my office and I will be eternally grateful if you manage to solve this strange problem. Cheers

  • TheRobRush Profile Picture
    11,121 Moderator on 26 Mar 2022 at 04:46:03
    Re: CountA & CountIf Counts Empty Rows?

    How are you clearing your collection exactly?

     

    Trying to reproduce that behavior and it is not occurring

     

     

    Clear(allassets)

     

     

    chanegs my countrows(allassets) from 9 to 0 as expected. would you mind sharing the collect code where you collected it, the clear code where you cleared it, and then goto collections area and send a picture of what the collection looks like after the clear?

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete