cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KimberlyM
Level 8

CountIf using And and Or together not reporting back a different total than the total sum of item

CountIf(Lead_Data, AssignedTo.Value = AgentsName.SelectedText.Value || LeadMember1.Value = AgentsName.SelectedText.Value ||LeadMember2.Value = AgentsName.SelectedText.Value ||LeadMember3.Value = AgentsName.SelectedText.Value ||LeadMember4.Value = AgentsName.SelectedText.Value && SourceDetails.Value = "General")

 

I have lead myself to believe that this formula above says:
Count the entry if my Lead_Data source AssignedTo or,  LeadMember1 or, LeadMember2 or, LeadMember3 or, LeadMember4 column value = the name in the textbox selected AND SourceDetails must = "General".  

However I am just constantly receiving a count of the AssignedTo,  LeadMember1, LeadMember2, LeadMember3, LeadMember4 columns and it seems to be ignoring the SourceDetails column.

 

So for a particular name (CS) I would expect that the total entries under this name to be 43 and if I put the declaration of "AND SourceDetails = General" I would then expect that to report back a 0. 

Hoping this makes sense and someone can see an error I have made or show me where I am going wrong in my formula writing! Thank you in advance! 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: CountIf using And and Or together not reporting back a different total than the total sum of item

@KimberlyM 

A simple reordering of the FILTER might work.  I made the SourceDetails a separate criteria because it does the same thing as AND.  But the order might be what's more important here.

 

CountIf(
    Lead_Data, 
    SourceDetails.Value = "General",
    AssignedTo.Value = AgentsName.Selected.Value
    || LeadMember1.Value = AgentsName.Selected.Value
    || LeadMember2.Value = AgentsName.Selected.Value
    || LeadMember3.Value = AgentsName.Selected.Value
    || LeadMember4.Value = AgentsName.Selected.Value
)

 

 

Note: I also changed SelectedText to Selected.  SelectedText is being removed from PowerApps eventually so you will not want to use it in your app.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
Super User
Super User

Re: CountIf using And and Or together not reporting back a different total than the total sum of item

@KimberlyM 

A simple reordering of the FILTER might work.  I made the SourceDetails a separate criteria because it does the same thing as AND.  But the order might be what's more important here.

 

CountIf(
    Lead_Data, 
    SourceDetails.Value = "General",
    AssignedTo.Value = AgentsName.Selected.Value
    || LeadMember1.Value = AgentsName.Selected.Value
    || LeadMember2.Value = AgentsName.Selected.Value
    || LeadMember3.Value = AgentsName.Selected.Value
    || LeadMember4.Value = AgentsName.Selected.Value
)

 

 

Note: I also changed SelectedText to Selected.  SelectedText is being removed from PowerApps eventually so you will not want to use it in your app.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
KimberlyM
Level 8

Re: CountIf using And and Or together not reporting back a different total than the total sum of item

This worked perfectly! Thank you for suggesting this!

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,221)