While working in InfoPath you assume you have a repetitive section with a lookup from following xml

 ...

            <Z>

                        <X>

                                    <Y>value1</Y>

                        </X>

                        <X>

                                    <Y>value2</Y>            

                        </X>

                        <X>

                                    <Y>value1</Y>            

                        </X>

            </Z>

 ...

And, you want to display unique values from the repetitive section here is a solution

 

if you are using code

DOMNodeList nodelist = thisXDocument.DOM.selectNodes(//Z/X[not(Y=preceding-sibling::*/Y)]/Y);

            foreach (DOMNode node in nodelist)

            {               

                thisXDocument.UI.Alert(node.text);

            }

 

If you are using UI rules you can get individual distinct values by x-path

 

(//Z/X[not(Y=preceding-sibling::*/Y)]/Y)[1]

(//Z/X[not(Y=preceding-sibling::*/Y)]/Y)[2]

 and so on…

 

 

I wish InfoPath had XPath 2.0 support or some other extensions so we could use distinct-values() function