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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
brankocareer
Regular Visitor

Group by depending on value in another column

Hi all,

There are 4 column in Power Query: [Position ID],[Modified Date],[Date],[FTE Count], the data type of [Modified Date] is Date/Time . Data Type of [Date] is Date.

brankocareer_0-1714082287092.png

 


I want to add a new column in power query after step "Filtered Row2".
The condition is: for each [Position ID] (I just filter one ID as example), for each day, get the value of [FTE Count] at the latest time of that day's  [Modified Date]. Result like this:

brankocareer_1-1714082581898.png

 

 

I want to insert step after, to group by, how should I write the code?

 

I greatly appreciate your help!!!

Branko

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

=Table.FromRecords(Table.Group(#"Filtered Row2",{"Position ID","Date"},{"n",each Table.Sort(_,{"Modified Date",1}){0}})[n])

View solution in original post

1 REPLY 1
wdx223_Daniel
Super User
Super User

=Table.FromRecords(Table.Group(#"Filtered Row2",{"Position ID","Date"},{"n",each Table.Sort(_,{"Modified Date",1}){0}})[n])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors