cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ByPA
Helper I
Helper I

Countif

Hi,

 

I have 5 Text Input Control boxes, for which  I set the Format under Properties to be Numbers

 

ByPA_0-1633852575614.png

 

 

I collected the values in a collection called "RecordYears"

 

ByPA_1-1633851435328.png

 

 

If I create a context variable and Sum the NumClaims column, it is ok.

However, if I create a context variable and CountIf(RecordYears, NumClaims>0), I get an incompatible type error...

 

Since it is only 5 records, I don't think it is a delegation issue? How can I get countif to work?

 

Thanks for help!

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @ByPA,

 

As an alternative approach couldn't you convert the NumClaims to an integer by using a value function?

 

CountIf(RecordYears, Value(NumClaims) > 0)

 

View solution in original post

3 REPLIES 3
ByPA
Helper I
Helper I

I stumbled upon a workaround...by adding "" before and after the 0 but it means that the value in the text input control is a text and not a number despite setting Format under Properties to be Numbers?

 

UpdateContext({CountTotal:CountIf(RecordYears,NumClaims<>"0")});

Expiscornovus
Super User
Super User

Hi @ByPA,

 

As an alternative approach couldn't you convert the NumClaims to an integer by using a value function?

 

CountIf(RecordYears, Value(NumClaims) > 0)

 

View solution in original post

ByPA
Helper I
Helper I

 

Hi 

 

Thanks so much! Your suggestion is much better! 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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