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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors