in your database retrieve you are doing retrieve which results in a list of courses. Not a singular course.
Because of this you can not use $Course/duration because it can not resolve which course from the list it should be.
If your intention is to only get 1 course from your database retrieve, you can set the retrieve to 'First' instead of 'All'. Which then returns just 1 course instead of a list of courses.
Here is an example:
This current setup should work, given that you have retrieved the 'correct' course
If i understand correctly: Currently your EndDate is always changing to 5 days later than the start date?
If i have to take a guess, Your retrieve from database is most likely always retrieving the same course, which has a duration of 5 days.
What is the path you retrieve by? Because you would need to retrieve the 'correct' course to be able to use the correct duration.
So here's a question for you: How does your microflow currently know which Course you selected? In your current setup the only information the microflow has available is in your retrieve from database. If your constraint on retrieving from the database is always a fixed course, you'll always receive that course from the retrieve. Otherwise, if you don't specify a constraint, it will just retrieve the first one it encounters in the database. So that's always not what you're looking for.
You can take multiple approaches to reach your goal but you will need to specify which course a user selects in your microflow.
Either you pass it as a parameter, or retrieve it via an association or entity you've already set.
What is your user flow currently, where does a user select a course?
Tried to do this, but now no matter which course I select, the end date is 5 days later. My first course in the course overview list has a duration of 5 days, but if now I choose a different course with a different duration, nothing changes. Currently I only have courses with durations of 1,2,3 and 5 days, so the '-1' in the Change object formula also doesn't seem to work.
But indeed my error message has disappeared, but unfortunately it doesn't function correctly.