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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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