Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
AlanP514
Post Patron
Post Patron

Finding Max Record

Hi all, I need your help to solve this challenge 
Scenario is 

AlanP514_0-1658724601142.png

I have one table containing data like this, IT team triggers data many times a day, so I want to find the max date  values from each layer, Else I want to load only max date values to power bi 
Expected output is  

AlanP514_1-1658724797248.png

 

please help me to achieve this logic


2 ACCEPTED SOLUTIONS
PC2790
Community Champion
Community Champion

Hey @AlanP514 ,

 

You can use the concept of gouping here in Power Query.

Go to Power Query--> Home --> Group by 

In the group by section, you can put all your columns you want to group by and get the max(date) out of there.

Then you can merge it with your original table to get the desired records.

Power Query code as below:

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsxLzKksyUwuVtJRckksSQRSTkX5eVWpQIa5vpGhvpGBkZGCuZWhKVDAAIiNDHW9SnN0jYyUYnWI1W5oamVqRqz+4MycstQiFP2mVsYg7YYWZOo3MrIyNSTaAPf8nBQU7QYQ63VNyNJtaA6xHF17LAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source = _t, #"Stream Group" = _t, Layer = _t, #"Load Date" = _t, Value = _t, Date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Source", type text}, {"Stream Group", type text}, {"Layer", type text}, {"Load Date", type datetime}, {"Value", Int64.Type}, {"Date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Layer"}, {{"Max LoadDate", each List.Max([Load Date]), type nullable datetime}}),
    #"Merged Queries" = Table.NestedJoin(#"Grouped Rows", {"Layer", "Max LoadDate"}, #"Changed Type", {"Layer", "Load Date"}, "Grouped Rows", JoinKind.LeftOuter),
    #"Expanded Grouped Rows" = Table.ExpandTableColumn(#"Merged Queries", "Grouped Rows", {"Source", "Stream Group", "Value", "Date"}, {"Source", "Stream Group", "Value", "Date"})
in
    #"Expanded Grouped Rows"

 

Attaching a sample file for reference.

Output would be:

PC2790_0-1659587201051.png

 

View solution in original post

v-yanjiang-msft
Community Support
Community Support

Hi @AlanP514 ,

According to your description, here's my solution.

Create a measure:

Check =
IF (
    MAX ( 'Table'[Load Date] )
        = MAXX (
            FILTER ( ALL ( 'Table' ), 'Table'[Layer] = MAX ( 'Table'[Layer] ) ),
            'Table'[Load Date]
        ),
    1,
    0
)

Put the measure in the visual filter and select its value to1.

vkalyjmsft_0-1659002057714.png

After apply filter, get the expected result.

vkalyjmsft_1-1659002098935.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @AlanP514 ,

According to your description, here's my solution.

Create a measure:

Check =
IF (
    MAX ( 'Table'[Load Date] )
        = MAXX (
            FILTER ( ALL ( 'Table' ), 'Table'[Layer] = MAX ( 'Table'[Layer] ) ),
            'Table'[Load Date]
        ),
    1,
    0
)

Put the measure in the visual filter and select its value to1.

vkalyjmsft_0-1659002057714.png

After apply filter, get the expected result.

vkalyjmsft_1-1659002098935.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

 

PC2790
Community Champion
Community Champion

Hey @AlanP514 ,

 

You can use the concept of gouping here in Power Query.

Go to Power Query--> Home --> Group by 

In the group by section, you can put all your columns you want to group by and get the max(date) out of there.

Then you can merge it with your original table to get the desired records.

Power Query code as below:

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsxLzKksyUwuVtJRckksSQRSTkX5eVWpQIa5vpGhvpGBkZGCuZWhKVDAAIiNDHW9SnN0jYyUYnWI1W5oamVqRqz+4MycstQiFP2mVsYg7YYWZOo3MrIyNSTaAPf8nBQU7QYQ63VNyNJtaA6xHF17LAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source = _t, #"Stream Group" = _t, Layer = _t, #"Load Date" = _t, Value = _t, Date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Source", type text}, {"Stream Group", type text}, {"Layer", type text}, {"Load Date", type datetime}, {"Value", Int64.Type}, {"Date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Layer"}, {{"Max LoadDate", each List.Max([Load Date]), type nullable datetime}}),
    #"Merged Queries" = Table.NestedJoin(#"Grouped Rows", {"Layer", "Max LoadDate"}, #"Changed Type", {"Layer", "Load Date"}, "Grouped Rows", JoinKind.LeftOuter),
    #"Expanded Grouped Rows" = Table.ExpandTableColumn(#"Merged Queries", "Grouped Rows", {"Source", "Stream Group", "Value", "Date"}, {"Source", "Stream Group", "Value", "Date"})
in
    #"Expanded Grouped Rows"

 

Attaching a sample file for reference.

Output would be:

PC2790_0-1659587201051.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.