Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi all I have the following and i can't find the solution, any advice is appreciated
Tag Div Event Date
77AK9Y 04 04 20012020
77AK9Y 04 05 20012020
23AG4G 04 04 20012020
Desired result:
77AK9Y 04 05 20012020
23AG4G 04 04 20012020
Meaning if the event 5 exists for a record don't want to consider the event 4
Thanks
Solved! Go to Solution.
Hi @MarkCorzo70
You can use Group By with Max on Event as per below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjd39LaMVNJRMoFiIwMDQyMDIwOlWB00WVN0WSNjR3cTd6x6YwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Tag = _t, Div = _t, Event = _t, Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Tag", type text}, {"Div", Int64.Type}, {"Event", Int64.Type}, {"Date", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Tag", "Div", "Date"}, {{"Event", each List.Max([Event]), type number}})
in
#"Grouped Rows"
Hello @MarkCorzo70
this requires some writing of M-Code. I've prepared for you a solution that involves the Group-function with a special function, that filters for the max value in your Event-column. Check it out
let
Source = #table
(
{"Tag","Div","Event","Date"},
{
{"77AK9Y","04 ","04 ","20012020"}, {"77AK9Y","04 ","05","20012020"}, {"23AG4G","04 ","04","20012020"}
}
),
Group = Table.Group
(
Source,
{"Tag", "Div"},
{{"AllRows", (tableint)=> let
RemoveColumns = Table.RemoveColumns(tableint, {"Tag", "Div"}),
SelectMaxEvent = Table.SelectRows(RemoveColumns, each [Event]= List.Max(tableint[Event]))
in
SelectMaxEvent,
type table [Event=text, Date=text]}}
),
ExpandTable = Table.ExpandTableColumn(Group, "AllRows", {"Event", "Date"}, {"Event", "Date"})
in
ExpandTable
Copy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hi @MarkCorzo70
You can use Group By with Max on Event as per below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjd39LaMVNJRMoFiIwMDQyMDIwOlWB00WVN0WSNjR3cTd6x6YwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Tag = _t, Div = _t, Event = _t, Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Tag", type text}, {"Div", Int64.Type}, {"Event", Int64.Type}, {"Date", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Tag", "Div", "Date"}, {{"Event", each List.Max([Event]), type number}})
in
#"Grouped Rows"
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |