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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Pravdba
New Member

Need to capture state with min change date for every state as shown from table1 to table 2

Hi, 

Help me on this, I have table1 having historical data i need to achieve Table 2,  Need to capture min change date of every state if it was repeated state after state it should also capture.

Table 1

 ID

State

ChangeDate

1

Proposed

08-03-2024 00:00

1

Proposed

09-03-2024 00:00

1

Analysis

25-03-2025 00:00

1

Authoring

26-03-2025 00:00

1

Authoring

27-03-2025 00:00

1

Blocked

06-02-2025 00:00

1

Blocked

07-02-2025 00:00

1

Analysis

08-02-2025 00:00

2

Proposed

08-03-2024 00:00

2

Authoring

25-03-2025 00:00

2

Analysis

29-07-2024 00:00

2

Blocked

06-02-2025 00:00

2

Blocked

07-02-2025 00:00

2

Authoring

08-02-2025 00:00


Table 2

 Id

State

MinChangeDate

1

Proposed

08-03-2024 00:00

1

Analysis

25-03-2025 00:00

1

Authoring

26-03-2025 00:00

1

Blocked

06-02-2025 00:00

1

Analysis

08-02-2025 00:00

2

Proposed

08-03-2024 00:00

2

Authoring

25-03-2025 00:00

2

Analysis

29-07-2024 00:00

2

Blocked

06-02-2025 00:00

2

Authoring

08-02-2025 00:00



Thanks

Praveen Kumar

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This M code in Power Query works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"State", type text}, {"ChangeDate", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"ID", "State"}, {{"Count", each List.Min([ChangeDate]), type nullable date}},GroupKind.Local)
in
    #"Grouped Rows"

Hope this helps.

Ashish_Mathur_0-1744068904190.png

 


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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

This M code in Power Query works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"State", type text}, {"ChangeDate", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"ID", "State"}, {{"Count", each List.Min([ChangeDate]), type nullable date}},GroupKind.Local)
in
    #"Grouped Rows"

Hope this helps.

Ashish_Mathur_0-1744068904190.png

 


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

Hi @Pravdba ,

If a community member's response addressed your query, please consider marking it as Accepted Answer and click Yes if you found it helpful.

 

If you have any further questions, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!

 

Hi @Pravdba ,

We haven’t heard back from you regarding our previous response and wanted to check if your issue has been resolved.

If it has, please consider clicking “Accept Answer” and “Yes” if you found the response helpful.
If you still have any questions or need further assistance, feel free to let us know — we're happy to help!

Thank you!

Hi @Pravdba ,


If a community member's response addressed your query, please consider marking it as Accepted Answer and click Yes if you found it helpful.

If you have any further questions, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.