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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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