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
kx_xoxo
New Member

Locate the grouped by min and max value from the source and delete those rows

Hi there, 

 

I have the following table and was able to use the GroupBy feature to find out the min and max value for each browser on each day. My goal is to delete the rows with those values in the original table but got stuck. Thank you for your help!

 

kx_xoxo_0-1727737197939.png

 

Grouped view: 

kx_xoxo_1-1727737308997.png

 

 

 

 

5 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Expand the data values again and then filter out the rows where the value matches either the min or the max value in that row. Then remove the max and min columns.

View solution in original post

Omid_Motamedise
Super User
Super User

You can use Table.SelectRows for the sub tables.


If my answer helped solve your issue, please consider marking it as the accepted solution.

View solution in original post

Anonymous
Not applicable

Hi,

Thanks for the solution Omid_Motamedise and lbendlin offered, and i want to offer some more information for user to refer to.

hello @kx_xoxo , you can create a blank query and put the following code to advanced editor in power query.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wck1JT1XSUbLUNzLTNzIwMgGyLfQslGJ1sEoZGuqZ4JKz0DPDo80Yp5wRbiMNDaByzhlF+blQWVOYrKWeOW5JoFYjPLImeqb4DMYraYHHXEN8WoG2WuKRNQN5NhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Broswer = _t, Date = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Broswer", type text}, {"Date", type date}, {"Value", type number}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Broswer", "Date"}, {{"Min", each List.Min([Value]), type nullable number}, {"Max", each List.Max([Value]), type nullable number}, {"Data", each _, type table [Broswer=nullable text, Date=nullable date, Value=nullable number]}}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Value"}, {"Value"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Data", each ([Value] <> [Min]) and ([Value]<>[Max]))
in
    #"Filtered Rows"

Output

vxinruzhumsft_0-1728265134649.png

Best Regards!

Yolo Zhu

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

slorin
Super User
Super User

Hi @kx_xoxo 

 

Table.Combine(
Table.Group(
Your_Source,
{"Broswer", "Date"},
{{"Data", each Table.RemoveMatchingRows(_, {Table.Max(_, "Value"), Table.Min(_, "Value")})}}
)[Data]
)

 Stéphane

View solution in original post

kx_xoxo
New Member

Thanks all! 

 

I was able to add a helper column filter out the rows matches the max and min values. Thank you again for giving me ideas. 

View solution in original post

5 REPLIES 5
kx_xoxo
New Member

Thanks all! 

 

I was able to add a helper column filter out the rows matches the max and min values. Thank you again for giving me ideas. 

slorin
Super User
Super User

Hi @kx_xoxo 

 

Table.Combine(
Table.Group(
Your_Source,
{"Broswer", "Date"},
{{"Data", each Table.RemoveMatchingRows(_, {Table.Max(_, "Value"), Table.Min(_, "Value")})}}
)[Data]
)

 Stéphane

Anonymous
Not applicable

Hi,

Thanks for the solution Omid_Motamedise and lbendlin offered, and i want to offer some more information for user to refer to.

hello @kx_xoxo , you can create a blank query and put the following code to advanced editor in power query.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wck1JT1XSUbLUNzLTNzIwMgGyLfQslGJ1sEoZGuqZ4JKz0DPDo80Yp5wRbiMNDaByzhlF+blQWVOYrKWeOW5JoFYjPLImeqb4DMYraYHHXEN8WoG2WuKRNQN5NhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Broswer = _t, Date = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Broswer", type text}, {"Date", type date}, {"Value", type number}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Broswer", "Date"}, {{"Min", each List.Min([Value]), type nullable number}, {"Max", each List.Max([Value]), type nullable number}, {"Data", each _, type table [Broswer=nullable text, Date=nullable date, Value=nullable number]}}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Value"}, {"Value"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Data", each ([Value] <> [Min]) and ([Value]<>[Max]))
in
    #"Filtered Rows"

Output

vxinruzhumsft_0-1728265134649.png

Best Regards!

Yolo Zhu

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

 

Omid_Motamedise
Super User
Super User

You can use Table.SelectRows for the sub tables.


If my answer helped solve your issue, please consider marking it as the accepted solution.
lbendlin
Super User
Super User

Expand the data values again and then filter out the rows where the value matches either the min or the max value in that row. Then remove the max and min columns.

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.