Hide/Suppress Rows Based on Data in Other Rows

VoidAurochs

New member
Joined
Jan 15, 2019
Messages
3
Reaction score
0
Points
0
Excel Version(s)
365
I'm new to Power Query & M Code, so forgive me if this is 'easy'.

I have one column with PO numbers which may be repeated depending on line items on PO and revision number.
I have another column with PO revision number which also may be repeated for each line item on a PO.

I want to hide/suppress the older revisions of the POs and only show the latest (highest revision number).
I looked through the Power Query M function reference but still have no idea how to get started with this. I do know how to create steps and write some M code, but not this level of cross-referencing.

In Excel I would have done something like IF(_rev=MAXIFS(_revs,_POs,_PO),"X","-") and filter for "X".
 
You have to create a column that shows the maximum revision for each PO. You can do that with grouping and merging, or direct with a custom function. Then create a helper column and filter on it. I attached a file showing both ways

View attachment o.xlsx
 
Thanks...

Struggling with this one though: (i) => List.Max(Table.SelectRows(Source, each [PO] = i[PO])[Revision])
Why is the first i in parenthesis? Is i a special function? What happens when you put i in front of the [PO] record? Not even sure what to look up for this.

There are two things going on here:
1) The data we are looking to find max of is defined by Table.SelectRows(Source, each [PO] = i[PO])[Revision]
Table.SelectRows is selecting data (rows) from the Source table based on a condition.
The condition is that each [PO] = i[PO], but I'm not clear on what i[PO] means.
2) The list of rows generated that meet the criteria are evaluated by the Max function based on their [Revision] column.

So a new column is generated showing max PO revision.
 
Last edited:
I would suggest you stick with the other Query, that is much more easy-to-understand and uses data grouping until you get more advanced
 
I successfully implement the advanced method.
Any references on the (i) and i[] I can read? Any nomenclature I can look up?
 
Sorry, I don't know of any other than googling powerquery functions
 
Back
Top