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 / Invalid Formula: Expec...
Power Apps
Answered

Invalid Formula: Expected a value compatible with data source

(0) ShareShare
ReportReport
Posted on by 9

Hi, Thought I'd completed an app, but getting this error.

 

I'm using a dropdown to filter a gallery (Dropdown1) with this:
Distinct(D365Milestones,Workstream.Value)


The Item of the Gallery (BrowseGalleryMilestones) is doing this:
Distinct(Sort(Filter(D365Milestones, Workstream.Value = Dropdown1.Selected.Result), Created, Descending), Title)

 

Both work, and I thought I'd then just point an edit forms Item to BrowseGalleryMilestones.Selected, but I get "Invalild Formula: Expected a value compatible with data source".  I'm stumped.  Can anyone help me?

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @mmurch 

    Your Items on the Gallery are going to return a Table with a single column called Result.  That is NOT going to be compatible with your datasource record!

     

    But here is my question...if you are using Distinct on your list for the Title and, let's say there are 5 items in your list that have the same title...which one would you then be expecting to edit in your EditForm???

     

    So, the question is, do you need distinct on your gallery?  And if so, then what do you expect to edit?

     

     

  • mmurch Profile Picture
    9 on at

    That's for the super quick reply. Unfortunately the user, if this refers works, does not want to overwrite the status of, say, a milestone, they want to create a separate record each time it's updated so they retain a history. Meaning there will be multiple records with the same title. So I need the gallery to only show the last created record for each title. This is what I thought the gallery was doing, so the edit form would navigate to that selected record. (Can you tell I'm new to this?)

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @mmurch 

    So your choice of Distinct is just the wrong one.  Distinct is going to do as I mentioned before...give you a distinct list of JUST the column you want distinct of.  There will be NO other record details with it.

     

    Here is what I would recommend for your Items property of the Gallery:

    ForAll(
     GroupBy(
     Filter(D365Milestones, Workstream.Value = Dropdown1.Selected.Result),
     "Title",
     "_recs"
     ),
     Patch(First(SortByColumns(_recs, Created, Descending)), {Title: Title})
    ) 

    This will return the most recent record for each distinct title.

    And, it will have the same record schema that is expected for the EditForm.

     

  • mmurch Profile Picture
    9 on at

    Wizardry. Thanks @RandyHayes .

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 383 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard