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 / Set variable to true i...
Power Apps
Answered

Set variable to true if certain columns are empty

(0) ShareShare
ReportReport
Posted on by 407

Hi all, 

 

I'm working on setting a visibility of a button based on two conditions. 

 

Example: 

Condition 1: if column a, column b and colum c are empty, set variable1 to true.

 

Condition 2: if column d, column e and column f are empty set variable2, true.

 

Any help is appreciated.

Categories:
I have the same question (0)
  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @_sourcecod3_ ,

     

    I recommend that you use the CountRows function to count the number of empty records in a column and compare this number to the total number of records in the data to determine if the column is empty.

    You can refer to this code to set the OnSelect property.

     

    If(CountRows(Filter(datasource,a=Blank()))=CountRows(datasource)&&CountRows(Filter(datasource,b=Blank()))=CountRows(datasource)&&CountRows(Filter(datasource,c=Blank()))=CountRows(datasource),Set(vaiable1,true))

    Hope this helps you!

    -------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

     

  • Verified answer
    WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @_sourcecod3_ ,

    The structure would be something like this

    UpdateContext(
     {
     Variable1:
     ColumnA = Blank() && ColumnB = Blank(),
     Variable2:
     ColumnD = Blank() && ColumnE = Blank()
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard