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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PeraZo
Helper I
Helper I

How to compare 2 rows and retain a row that is lower

Hello community,

 

In the dataset below, there are 2 rows with different rate.

I want to retain row that is lower (cheaper) comparing tariff.

The destination is same but the origin is different.

 

So in this case, I want to retain the red boxed row since 720 is lower than 780.

Is there way to do this by using Power Query Editor? 

 

スクリーンショット 2024-04-05 010528.png

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @PeraZo ,

@lbendlin , thanks for your concern about this case. I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution:  

I create a table as you mentioned.

vyilongmsft_0-1712544703396.png

Then I go to the Power Query, add index and remove duplicates.

vyilongmsft_1-1712544950319.png

vyilongmsft_2-1712544973760.png

vyilongmsft_3-1712545017430.png

Finally you will get what you want.

vyilongmsft_4-1712545120885.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yilong-msft
Community Support
Community Support

Hi @PeraZo ,

@lbendlin , thanks for your concern about this case. I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution:  

I create a table as you mentioned.

vyilongmsft_0-1712544703396.png

Then I go to the Power Query, add index and remove duplicates.

vyilongmsft_1-1712544950319.png

vyilongmsft_2-1712544973760.png

vyilongmsft_3-1712545017430.png

Finally you will get what you want.

vyilongmsft_4-1712545120885.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PeraZo
Helper I
Helper I

Thank you for quick response.

I tried but it did not delete the row that is on top of the other one.

 

It retained all the column A the same value.

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

lbendlin
Super User
Super User

1. sort your table by Destination and Tariff

2. select the Destination column and Remove Duplicates

 

That will keep the first row for each Destination value.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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