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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
ngocnguyen
Helper IV
Helper IV

Fill up columns with conditions in power query

Hi all

I have below table. Now I wanna create a "Max rate" columns with below logic:

Fill up the Max rate of max distance for 1 shipment in column" Max rate"

Ex: Shipment B have 2 rates with max distance ( 12) : 1719 and 1741  => fill up 1741 into " Max rate" column

 

So, is there any way to do it with POWER QUERY?

 

Thanks in advance for your support!

 

 

Capture.PNG

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

Hi @ngocnguyen  , 

 

According to you description, You could copy the two tables first, and then group and merge .The steps are as follows

Step1: Coptwo tables

v-yalanwu-msft_0-1620727968270.png

Step2: Group by

v-yalanwu-msft_1-1620727968280.png

Step3: merge two tables and expanded tables

v-yalanwu-msft_2-1620727968272.pngv-yalanwu-msft_3-1620727968273.png

 

Step4: add conditional column and remove empty rows:

 
 

v-yalanwu-msft_12-1620728093597.jpegv-yalanwu-msft_5-1620727968275.png

 

Step5: Group by

v-yalanwu-msft_6-1620727968282.png

Step6 : merge two tables and expanded tables

v-yalanwu-msft_7-1620727968283.pngv-yalanwu-msft_8-1620727968277.png

The final output is shown below:

v-yalanwu-msft_9-1620727968278.png

 

Best Regards,
Community Support Tea
m_ Yalan Wu
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

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi @ngocnguyen  , 

 

According to you description, You could copy the two tables first, and then group and merge .The steps are as follows

Step1: Coptwo tables

v-yalanwu-msft_0-1620727968270.png

Step2: Group by

v-yalanwu-msft_1-1620727968280.png

Step3: merge two tables and expanded tables

v-yalanwu-msft_2-1620727968272.pngv-yalanwu-msft_3-1620727968273.png

 

Step4: add conditional column and remove empty rows:

 
 

v-yalanwu-msft_12-1620728093597.jpegv-yalanwu-msft_5-1620727968275.png

 

Step5: Group by

v-yalanwu-msft_6-1620727968282.png

Step6 : merge two tables and expanded tables

v-yalanwu-msft_7-1620727968283.pngv-yalanwu-msft_8-1620727968277.png

The final output is shown below:

v-yalanwu-msft_9-1620727968278.png

 

Best Regards,
Community Support Tea
m_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
 

amitchandak
Super User
Super User

@ngocnguyen , You have this video deal with category max - if that can help

https://www.youtube.com/watch?v=8KaMj2DFpWg

 

In DAX you can a new column

new column =
var _1 = maxx(filter(Table, [shipment no] =earlier([shipment no])),[distance])
return
maxx(filter(Table, [shipment no] =earlier([shipment no]) && [distance] =_1),[Rate])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

thanks for your rep. However, I wanna create formulas in Power query. So is there any way to do it?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.