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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
kilala
Resolver I
Resolver I

PBI DAX Query: Remove duplicates and do formatting

Hi all, I want to add a column in PBI Query in my existing table.

 

Basically, I have 2 column, Name and In/Ex.

NameIn/Ex
AliIn
AliEx
AliEx
AbuIn
AmatEx

 

if there is duplicate on the name, I want to check the In/Ex column. If there is In there, I want to change all to In. If not, maintain the column as it is. The expected output:
NameIn/Ex
AliIn
AbuIn
AmatEx

How to do this in Power BI query?
1 ACCEPTED SOLUTION
Zang_Mi
Resolver II
Resolver II

Hello,

 

You can achieve this result by doing the following:
1 - Group by data rows by Name and concatenas all the values from In/Ex.

Zang_Mi_0-1711699860640.png

 

2 - Based on the new column In/Ex, create a custom column (or just transform the current one) applying the logic: if the text contains "In" then return "In, otherwise, return "Ex".

Zang_Mi_1-1711699972636.png

These are the 2 steps you can add to the query:

Zang_Mi_2-1711700171709.png

 

View solution in original post

1 REPLY 1
Zang_Mi
Resolver II
Resolver II

Hello,

 

You can achieve this result by doing the following:
1 - Group by data rows by Name and concatenas all the values from In/Ex.

Zang_Mi_0-1711699860640.png

 

2 - Based on the new column In/Ex, create a custom column (or just transform the current one) applying the logic: if the text contains "In" then return "In, otherwise, return "Ex".

Zang_Mi_1-1711699972636.png

These are the 2 steps you can add to the query:

Zang_Mi_2-1711700171709.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.