Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Issue using If and Count IF statements and getting an incompatible type comparison error

(1) ShareShare
ReportReport
Posted on by
I have a SharePoint list that is collating multiple rows of data for the same person - screenshot below:
 
 
I have then linked this to a PowerApp to help with summarising the multiple rows:
 
 
I have created a collection for my Sharepoint list but for the Label where I am trying to count the number of National Assessors for Title: 423476 I have this formula:
If(colSummary[@'Title']=ThisItem.'Title',CountIf(colSummary,colSummary[@'NationalORInternational']="National"))
 
With the below error:
The expression is intended to check if the title of the current item (`ThisItem.Title`) is equal to the title in the `colSummary` record (`colSummary.Title`). If they are equal, it aims to count the number of records in `colSummary` where the `NationalORInternational` field is equal to "National".

The error encountered is due to an incompatible type comparison. Specifically, the `Equals` function is being used incorrectly; it is trying to compare a record (`colSummary`) with a text value (`ThisItem.Title`). The `Equals` function expects both arguments to be of compatible types (e.g., both should be text), but in this case, one is a record and the other is a text string, leading to the type mismatch error.
 
Any suggestions for how to correct the incompatible type comparison error?
  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,642 Super User 2024 Season 1 on at
    Issue using If and Count IF statements and getting an incompatible type comparison error
    Try below formula once. Let me know if it works.
     
    CountIf(
        colSummary,
        Title = ThisItem.Title && NationalORInternational = "National"
    )

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,361 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,392 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans