web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Incompatible types for...
Power Apps
Answered

Incompatible types for comparison error when filtering DataTable

(1) ShareShare
ReportReport
Posted on by 169

I have a SharePoint list called SEL with stability study data. I'm building a screen where users can bulk-update the EWD (Expected Withdrawal Date) field based on selected filters.

 

Columns in SEL:

  • Condition - Choice column
  • Rack - Single line of text
  • EWD - Date and Time
  • (Plus other columns: Title, BNo, PrdCode, IncDate, PackType, Stage, etc.) 
 

Screen Controls:

  1. cmbCondition (ComboBox - Single Selection)
    • Items: Choices(SEL.Condition)
    • Fields: Primary = Value
  2. cmbRack (ComboBox - Multiple Selection)
    • Items: Distinct(SEL, Rack)
    • SelectMultiple: true
    • Fields: Primary = Value
  3. DataTable_SEL (DataTable)
    • Should show filtered records based on selected Condition AND selected Rack(s)
    • If nothing is selected, show all SEL records
  4. txtDaysShift (TextInput) - Number of days to shift
  5. btnShiftEWD (Button) - Apply the date shift

What I Need:

  Filter the DataTable to show records where:
 
  • Condition matches the selected value from cmbCondition (if selected)
  • Rack matches ANY of the selected values from cmbRack (if selected)
  • If neither filter is selected, show all records

  •  

The Error:

  I keep getting: "Incompatible types for comparison. These types can't be compared: Table, Text"
  The error appears in the comparison: Condition.Value = cmbCondition.Selected.Value
 

What I've Tried:

If(
    IsBlank(cmbCondition.Selected.Value) && CountRows(cmbRack.SelectedItems) = 0,
    SEL,
    Filter(
        SEL,
        (IsBlank(cmbCondition.Selected.Value) || Condition.Value = cmbCondition.Selected.Value) &&
        (CountRows(cmbRack.SelectedItems) = 0 || 
            CountRows(Filter(cmbRack.SelectedItems, Value = Rack)) > 0
        )
    )
)

  Diagnostic Tests that WORK:

  • First(SEL).Rack returns "2" (text value) ✓
  • First(SEL).Condition.Value returns the condition text ✓
  • Filter(SEL, Rack = "2") works fine ✓
  • Concat(cmbRack.SelectedItems, Value, ", ") shows selected racks correctly ✓

Question:

  What's the correct formula to filter a DataTable using:
  1. A single-select Choice column (Condition)
  2. A multi-select text column (Rack)

Without getting the "Incompatible types" error?

Any help would be greatly appreciated!

Categories:
I have the same question (0)
  • Suggested answer
    wolenberg_ Profile Picture
    1,476 Super User 2026 Season 1 on at

    Hello ! you're very close! The error you're seeing—"Incompatible types for comparison"—is due to how Power Apps interprets the Condition.Value and cmbCondition.Selected.Value. Even though both look like text, one might be wrapped in a record or table structure depending on context.

     

     Corrected Filtering Formula

     

    Try this refined version:

    If(
        IsBlank(cmbCondition.Selected.Value) && CountRows(cmbRack.SelectedItems) = 0,
        SEL,
        Filter(
            SEL,
            (
                IsBlank(cmbCondition.Selected.Value) || 
                Text(Condition.Value) = Text(cmbCondition.Selected.Value)
            ) &&
            (
                CountRows(cmbRack.SelectedItems) = 0 || 
                Rack in Concat(cmbRack.SelectedItems, Value, "|")
            )
        )
    )
     

    Why This Works

     

    • Text(...) ensures both sides of the comparison are treated as plain text.

    • Concat(..., "|") creates a delimited string of selected rack values, and Rack in ... checks if each record’s rack is in that list.

    • This avoids comparing a table to a text value, which is what caused the original error. 


    •  

    If Rack values might contain special characters, consider using a collection instead of Concat for cleaner logic:

     
    Rack in cmbRack.SelectedItems.Value
    
     

    But this only works if SelectedItems is a flat list of text values.

     

    If this helped or could help others in the community, feel free to give it a like or a kudo — it helps surface useful answers for everyone!



  • WarrenBelz Profile Picture
    155,479 Most Valuable Professional on at
    Firstly, I need to highlight this community's Responsible AI policies as I received a remarkably similar answer to the first response (including the formating) when I posted your question into ChatGPT.
     
    Now to your issue, which seems a little odd based on the structure you posted, so to confirm
    1. SEL is a SharePoint List
    2. Condition is a Single Value Choice column in this List
    3. cmbCondition is a Single Choice Combo Box with the Items Choices(SEL.Condition)
    4. Rack is a Single Line of Text column in this List
    5. cmbRack is a Multiple Choice Combo Box with the Items Distinct(SEL, Rack)
     
    So the first issue if all of this (particularly 2 & 3) is correct is that Condition.Value = cmbCondition.Selected.Value is a valid comparison (both sides are Strings) - also noting that adding Text() does not turn a Table into Text. You might double check that both the field and the Combo Box are single selections.
     
    Your issue however also includes some challenges on Delegation as multiple value choices generally require non-delegable operators such as the In filter or in your case you have used CountRows
     
    I have tested the code below on a model with the same field and control types listed above that you have posted, so if you still get an error, these need to be re-checked. This structure should manage the Delegation issues
    If(
       CountRows(cmbRack.SelectedItems) = 0,
       Filter(
          SEL,
          Len(cmbCondition.Selected.Value) = 0 ||
          Condition.Value = cmbCondition.Selected.Value
       ),
       Ungroup(
          ForAll(
             cmbRack.SelectedItems As _Items,
             Filter(
                SEL,
                Rack = _Items.Value && 
                (
                   Len(cmbCondition.Selected.Value) = 0 || 
                   Condition.Value = cmbCondition.Selected.Value
                )
             ),
             Value
          )
       )
    )
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful?
    Visit my blog
    Practical Power Apps    LinkedIn  
  • WarrenBelz Profile Picture
    155,479 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for. Happy to assist further if not.
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful?
    Visit my blog
    Practical Power Apps    LinkedIn   
  • Verified answer
    amralomari Profile Picture
    169 on at
    Thanks a lot dear @wolenberg_ & dear @WarrenBelz for your time trying to solve my issue. and I'm sorry I've not read the  Responsible AI policies before, accordingly, I declare that the code I've posted and the solution I found below was made in help with Claude sonnet 4.5 and depends on wolenberg_'s code. 

    The Problem with the Suggested Solution:

    The initial suggestion to use Text(Condition.Value) for comparison didn't work because of a context ambiguity issue. Even though Condition.Value appeared to be a text value, PowerApps was interpreting it differently within nested Filter contexts, resulting in the persistent "Incompatible types for comparison: Table, Text" error.

    The breakthrough came when we tested: First(SEL).Condition.Value which also threw errors, confirming that the Condition column (a SharePoint Choice field) couldn't be directly referenced in certain contexts.

    The Working Solution:

      For DataTable Filtering (Part 1):
     

    Instead of using equality = comparison, using the in operator solved the issue:

    If(
        IsBlank(cmbCondition.Selected) && CountRows(cmbRack.SelectedItems) = 0,
        SEL,
        Filter(
            SEL,
            (
                IsBlank(cmbCondition.Selected) || 
                cmbCondition.Selected.Value in Condition.Value
            ) &&
            (
                CountRows(cmbRack.SelectedItems) = 0 || 
                !IsBlank(LookUp(cmbRack.SelectedItems, Value = Rack))
            )
        )
    )
     

    Key points:


    • Used in operator instead of = for Choice column comparison

    • Used !IsBlank(LookUp(...)) for multi-select ComboBox filtering

    • This avoided all context ambiguity issues 
    •   

     

    For the Bulk Update Button (Part 2):
      The submit button needed to:
     
    Capture records BEFORE updating (to show before/after in email)
    Update all matching records
    Send an HTML email notification with a table of changes  
    Important discovery: When using AddColumns, column names must be without quotes (at least in my PowerApps environment):
    ❌ Wrong: AddColumns(table, "NewColumn", value)
    ✅ Correct: AddColumns(table, NewColumn, value)
     
    Complete Button Formula: https://pastebin.com/WQDCy413 
     

    Key Learnings:

    1. Choice Column Comparison: Use in operator instead of = when comparing with SharePoint Choice columns in complex Filter contexts
    2. Multi-Select ComboBox: Use !IsBlank(LookUp(SelectedItems, Value = Field)) pattern for checking if a field value exists in selected item
    3. AddColumns Syntax: Column names without quotes (environment-dependent)
    4. Condition Workaround: Since we filtered by one condition, we stored cmbCondition.Selected.Value directly in the collection instead of trying to extract it from the problematic Condition.Value
    5. Date Formatting: Use "dd/mmm/yyyy" format for Text() function with dates
    6. TimeUnit: Use TimeUnit.Days (not just Days) in DateAdd() function
  • WarrenBelz Profile Picture
    155,479 Most Valuable Professional on at
    The comment on the responsible AI policy was not in reference to anything you posted.
     
    Assuming you are using SharePoint what you have posted is not Delegable ( hence my workaround).
    If(
       CountRows(cmbRack.SelectedItems) = 0,
       Filter(
          SEL,
          Len(cmbCondition.Selected.Value) = 0 ||
          Condition.Value = cmbCondition.Selected.Value
       ),
       Ungroup(
          ForAll(
             cmbRack.SelectedItems As _Items,
             Filter(
                SEL,
                Rack = _Items.Value && 
                (
                   Len(cmbCondition.Selected.Value) = 0 || 
                   Condition.Value = cmbCondition.Selected.Value
                )
             ),
             Value
          )
       )
    )
    If you are not worried about Delegation, you only need to do this.
    Filter(
       SEL,
       (
           CountRows(cmbCondition.SelectedItema)= 0 || 
           cmbCondition.Selected.Value in Condition.Value
       ) &&
       (
           CountRows(cmbRack.SelectedItems) = 0 || 
           Rack in cmbRack.SelectedItems.Value
       )
    )
    Users come to this community for some "Human Intelligence" and responders spend the time actually thinking about your problem and providing the best solution we can manage. AI will probably get there one day, but at a cost of (in a lot of cases) people having no understanding of why it actually works or how to fix it if it breaks.
     
    Please  Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful?
    Visit my blog 
    Practical Power Apps    LinkedIn   
  • WarrenBelz Profile Picture
    155,479 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for. Happy to assist further if not.
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn   

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

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 432

#2
Valantis Profile Picture

Valantis 362

#3
timl Profile Picture

timl 337 Super User 2026 Season 1

Last 30 days Overall leaderboard