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
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. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

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. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h
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
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.

Top Solution Authors