cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Piter_D
Post Patron
Post Patron

How can i use countif when in condition i want compare another column

Hi, I have a question, can I use CountIf, if I want to check if there is a value specified for this record in another column?

For example:

 

 CountIf(Shortages.Item, 'Production Line'.Text = "A")

 

Production Line is a column like Item in Table named Shortages

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Dual Super User
Dual Super User

@Piter_D ,

Yes ... The formula is quite good, but is a little bit slow for large data sources, as Countif() function iterate through entire data sources checking the formula.

 

 CountIf(Shortages, 'Production Line'.Text = "A")>0

 

For better results, use:

 

 IsBlank(LookUp(Shortages, 'Production Line' = "A"))

 

The result will be true if there is no record in Shortages table with condition fulfilled.

 

Hope it helps !

View solution in original post

6 REPLIES 6
JR-BejeweledOne
Super User
Super User

It's going to depend on where you are trying to put this formula.   Is this a selected item in a gallery?

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

In text label

JR-BejeweledOne
Super User
Super User

You indicated that this is for the current record.  How are you telling the text label that you have a record selected?   Is the label in a gallery or table for the current record?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

In the gallery

gabibalaban
Dual Super User
Dual Super User

@Piter_D ,

Yes ... The formula is quite good, but is a little bit slow for large data sources, as Countif() function iterate through entire data sources checking the formula.

 

 CountIf(Shortages, 'Production Line'.Text = "A")>0

 

For better results, use:

 

 IsBlank(LookUp(Shortages, 'Production Line' = "A"))

 

The result will be true if there is no record in Shortages table with condition fulfilled.

 

Hope it helps !

JR-BejeweledOne
Super User
Super User

To build on what @gabibalaban said, if you just need to see if the production line column for the selected record is blank.

 

IsBlank(ThisItem.'Production Line') 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,538)