One option is to use the ListUtils: https://appstore.home.mendix.com/link/app/81827/
See its documentation:
Example 4: List clean-up, removing redundant items
You may want to clean-up a list by removing duplicate items (i.e., items with the same attribute value). This can be achieved by using the Filter function with the following filter to get the unneeded redundant items:
<xsl:for-each-group select="record" group-by="@lastname">
<xsl:if test="count(current-group()) > 1">
<xsl:for-each select="current-group()">
<xsl:if test="position() > 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:for-each-group>
If you want to do this with your own microflow, you can keep it simpler:
https://modelshare.mendix.com/models/237d17b1-2480-4a80-a424-65481c544387/get-list-having-unique-values
You are missing a break inside the loop. See updated screenshot with my mad photoshop skillz