Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BalazsNy
Helper I
Helper I

Collect distinct items of a row in reverse order in Power Query

Hi All,

I would like to collect the distinct values in a row of multiple columns & combine them into 1 cell separated with comma in reverse order, as follows:

collect distinct.png
Could you suggest me a a formula within Power Query to get this result?

Thanks in advance.

 
 

 

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@BalazsNy 

you can try this to create a column in PQ

=Text.Combine( List.Distinct( List.Reverse (Record.ToList(_))),",")

 

11.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
Shahid12523
Community Champion
Community Champion

Use this Custom Column formula in Power Query:

= Text.Combine(List.Distinct(List.Reverse(Record.ToList(_))), ", ")


This gives your required output:

Row 1 → G, F, E, D, C, B, A

Row 2 → I, H, G, F, D, C, B

Shahed Shaikh
v-sshirivolu
Community Support
Community Support

Hi @BalazsNy ,

I would also take a moment to thank @ryan_mayu , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

 

Hi @BalazsNy ,

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you

 

Hi @BalazsNy ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

ryan_mayu
Super User
Super User

@BalazsNy 

you can try this to create a column in PQ

=Text.Combine( List.Distinct( List.Reverse (Record.ToList(_))),",")

 

11.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




pankajnamekar25
Super User
Super User

Hello @BalazsNy 

 

Create a cutome column use below code

 

Text.Combine(
List.Reverse(
List.Distinct(
List.RemoveNulls(
{
[col1],
[col2],
[col3],
[col4],
[col5],
[col6],
[col7],
[col8],
[col9],
[col10]
}
)
)
),
", "
)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors