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 / Formula to filter out ...
Power Apps
Suggested Answer

Formula to filter out inactive users

(1) ShareShare
ReportReport
Posted on by 52
Hello,
 
Can you please assist me in modifying this formula to filter out inactive users in office 365? Everything else I have tried to far using AI has had some kind of function does not exist error.
 
DropColumns(
   RenameColumns(
      AddColumns(
         AddColumns(
            Distinct(
               Filter(
                  PO_Requestors,
                  // 1. Verifies that the nested person profile is fully populated and active
                  !IsBlank(Requestor.Department) &&
                  !IsBlank(Requestor.Claims) &&
                  (IsBlank(DataCardValue8.Text) || StartsWith(Requestor.DisplayName, DataCardValue8.Text))
               ),
               Requestor.DisplayName
            ),
            _Record,
            LookUp(
               PO_Requestors,
               Requestor.DisplayName = Value
            ).Requestor
         ),
         Email,
         _Record.Email,
         Claims,
         "i:0#.f|membership|" & Lower(_Record.Email),
         Department,
         "",
         JobTitle,
         "",
         Picture,
         ""
      ),
      Value,
      DisplayName
   ),
   _Record
)
Categories:
I have the same question (0)
  • Suggested answer
    11manish Profile Picture
    3,333 on at
    To fix your issue:
    • There is no native “inactive user filter” in Power Apps
    • You must validate via Office365Users connector
    •  Use IfError + UserProfileV2 to safely filter deleted/disabled accounts
  • Suggested answer
    Kalathiya Profile Picture
    2,456 Super User 2026 Season 1 on at
    Hello @Sherazad,

    Yes, the AccountEnabled property from Office 365 Users can be used to determine if a user account is active or disabled.

    Just updated the code - Could you please try: 

    With({ 
            _data:PO_Requestors 
    },
    DropColumns(
       RenameColumns(
          AddColumns(
             AddColumns(
                Distinct(
                   Filter(
                      _data,
                      
                      !IsBlank(Requestor.Department) &&
                      !IsBlank(Requestor.Claims) &&
    
                      //Filter - Only include active users
                      IfError(
                         Office365Users.UserProfileV2(Requestor.Email).accountEnabled,
                         false
                      ) = true &&
    
                      (IsBlank(DataCardValue8.Text) ||
                       StartsWith(Requestor.DisplayName, DataCardValue8.Text))
                   ),
                   Requestor.DisplayName
                ),
                _Record,
                LookUp(
                   _data,
                   Requestor.DisplayName = Value
                ).Requestor
             ),
             Email,
             _Record.Email,
             Claims,
             "i:0#.f|membership|" & Lower(_Record.Email),
             Department,
             "",
             JobTitle,
             "",
             Picture,
             ""
          ),
          Value,
          DisplayName
       ),
       _Record
    )
    )
    ---------------------------------------------------------------------------
    Glad it helped 🙂
    If this fixed your issue,
    please click “Does this answer your question?” to mark it as verified so others can find the solution easily.
    A Like 👍 is always appreciated, and I’m around if you need more help @Kalathiya
  • Suggested answer
    Valantis Profile Picture
    6,735 on at
     
    accountEnabled is a real field on Office365Users.UserProfileV2, confirmed in Microsoft's connector docs.
     
    The IfError wrap is the right safety net since UserProfileV2 can throw for fully deleted or unresolvable accounts instead of just returning false.

    One thing worth knowing before you commit to this:
    calling Office365Users.UserProfileV2 inside a Filter that runs over Distinct means a separate network call per unique requestor, every time the formula re-evaluates. Fine for a small requestor list, but if PO_Requestors has hundreds of distinct people this will visibly slow down load time since none of it is delegable.

    If you start seeing lag, a faster alternative is to pre-populate a collection of accountEnabled statuses once (ClearCollect on App start, looping the distinct emails through UserProfileV2 a single time), then filter against that collection instead of calling the connector live inside this formula every time it runs.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard