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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
bkanderso
Helper I
Helper I

Creating A Function To Return Values based On Earliest Date

I have a table in power query and it has multiple students (unique Identifiers) and multiple colu,ns.  I need to write a function that will return the qualification earned during each semester based on the earliest date earned during that semester.  Each student has earned the same qualification multiple times in the same semester.  I am wanting the table to show the qualification earned only once and based on the earliest date it was earned during that semester.  Is this possible?

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @bkanderso ,

 

I made a sample data and below is my solution for you reference.

Data:

vstephenmsft_0-1683596952924.png

1.Select the Student column and group by.

vstephenmsft_1-1683597081795.png

vstephenmsft_2-1683597152769.png

vstephenmsft_3-1683597176397.png

2.If you also want to get rows before other columns, expand the All Rows.

vstephenmsft_4-1683597227471.png

vstephenmsft_6-1683597502495.png

3.Add a custom column for filtering.

vstephenmsft_5-1683597491873.png

vstephenmsft_8-1683597530082.png

4.Filter to keep the rows with 1.

vstephenmsft_7-1683597521659.png

vstephenmsft_9-1683597558664.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

 

View solution in original post

3 REPLIES 3
bkanderso
Helper I
Helper I

Thank you, this helps.

AlienSx
Super User
Super User

Hi, @bkanderso add "semester" into grouping (along with "student") if needed

groups = Table.Group(Source, {"Student"}, {{"all", each Table.Min(_, "Date")}}),
z = Table.FromRecords(groups[all])

 

v-stephen-msft
Community Support
Community Support

Hi @bkanderso ,

 

I made a sample data and below is my solution for you reference.

Data:

vstephenmsft_0-1683596952924.png

1.Select the Student column and group by.

vstephenmsft_1-1683597081795.png

vstephenmsft_2-1683597152769.png

vstephenmsft_3-1683597176397.png

2.If you also want to get rows before other columns, expand the All Rows.

vstephenmsft_4-1683597227471.png

vstephenmsft_6-1683597502495.png

3.Add a custom column for filtering.

vstephenmsft_5-1683597491873.png

vstephenmsft_8-1683597530082.png

4.Filter to keep the rows with 1.

vstephenmsft_7-1683597521659.png

vstephenmsft_9-1683597558664.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors