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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AshkanDRB
Frequent Visitor

Max date for each category with other values

Hi everyone
I have showed my need in this image.
Thanks in advance for your help.

AshkanDRB_0-1712389130622.png

 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Count", each Table.Max(_,"Date")}}),
    #"Expanded Count" = Table.ExpandRecordColumn(#"Grouped Rows", "Count", {"Date", "Status"}, {"Date", "Status"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Count",{{"ID", type text}, {"Date", type date}, {"Status", type text}})
in
    #"Changed Type"

Hope this helps.

Ashish_Mathur_0-1712447112059.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Just in case you want a solution using measures, then refer to my solution in the attached PBI file.

Hope this helps.

Ashish_Mathur_1-1712447524792.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Just in case you want a solution using measures, then refer to my solution in the attached PBI file.

Hope this helps.

Ashish_Mathur_1-1712447524792.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Count", each Table.Max(_,"Date")}}),
    #"Expanded Count" = Table.ExpandRecordColumn(#"Grouped Rows", "Count", {"Date", "Status"}, {"Date", "Status"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Count",{{"ID", type text}, {"Date", type date}, {"Status", type text}})
in
    #"Changed Type"

Hope this helps.

Ashish_Mathur_0-1712447112059.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish 
Thanks. Your both solutions work perfect.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
belvoir99
Resolver III
Resolver III

You can create a calculated table (Modeling > New Table):

SumTable = 
SUMMARIZECOLUMNS(
    'Table'[ID],
    "Date", MAX('Table'[Date]),
    "Status", 
    VAR MaxDate = MAX('Table'[Date])
    RETURN
    CALCULATE(VALUES('Table'[Status]), 'Table'[Date] = MaxDate)
)

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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.

Top Kudoed Authors