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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors