Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
How can i remove the row with highest order count in each shipment? For below data:
for example, for shipment # 37136 it should not show the row with order count 4
Solved! Go to Solution.
Let's say your last step was PriorStep. I would group by Shipment # column, and choose the Max Aggregation for the ORDER COUNT column. Name that step "Group" or whatever you want. Then you can join that table to PriorStep using a left anti join. So after grouping,
= Table.Join(PriorStep, {"SHIPMENT #", "ORDER COUNT"}, Group, {"GROUPED SHIPMENT # COLUMN", "Max ORDER COUNT"}, JoinKind.LeftAnti)
Side note: using the "#" character in your column name is going to get you into trouble some day, because somehow it'll get parsed as an escape character and mess up your quotes.
--Nate
What if the Shipment # has no duplicate?
Let's say your last step was PriorStep. I would group by Shipment # column, and choose the Max Aggregation for the ORDER COUNT column. Name that step "Group" or whatever you want. Then you can join that table to PriorStep using a left anti join. So after grouping,
= Table.Join(PriorStep, {"SHIPMENT #", "ORDER COUNT"}, Group, {"GROUPED SHIPMENT # COLUMN", "Max ORDER COUNT"}, JoinKind.LeftAnti)
Side note: using the "#" character in your column name is going to get you into trouble some day, because somehow it'll get parsed as an escape character and mess up your quotes.
--Nate
Table.SelectRows(prevStep, (x)=>x[orderCount]<>List.Max(Table.SelectRows(prevStep, (y)=> x[shipment]=y[shipment])[orderCount]))
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSAeJYHQjLCM4yBrOMgCxLOMvQQCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [shipment = _t, orderCount = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"shipment", Int64.Type}, {"orderCount", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", (x)=>x[orderCount]<>List.Max(Table.SelectRows(#"Changed Type", (y)=> x[shipment]=y[shipment])[orderCount]))
in
#"Filtered Rows"
@kaym try the above
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
8 | |
8 | |
7 |
User | Count |
---|---|
17 | |
11 | |
7 | |
6 | |
6 |