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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
arnaudmanir
Frequent Visitor

Second highest date

I'm in the auto finance industry and working on a table with thousands of serial numbers, corresponding funding date and payout date (if the loan is closed), all three listed in separate columns. If for example a vehicle was funded three times, you'll have three serial number rows each showing the corresponding advance date and payout date.

 

I want a list showing each asset that was financed more than once with columns showing the serial number, initial funding date, initial payout date, second funding date, second payout day, etc. I managed to create columns showing the initial and latest advance dates by using'Group by' and aggregating advance dates by min and max.

 

But what about the dates in between? For example if the same vehicle was funded four times, how can I pull the second advance date, the third advance date (since I already have the first and fourth occurence as min and max). 

1 ACCEPTED SOLUTION
ChielFaber
Solution Supplier
Solution Supplier

You probably get the result your looking for when you use group by and an index column to get an index per group.

 

In your use case you get an index per serial number. Look at Radacad's explanation on how to do this;

https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

 

After this step you can use the if function to fill the columns. For example

 

If index = 1 then initial‐funding date else null

 

Second funding date column will be

 

If index = 2 the initialfundingdate else null

 

 

 

 


[Tip] Keep CALM and DAX on.
[Solved?] Hit “Accept as Solution” and leave a Kudos.
[About] Chiel | SuperUser (2023–2) |

View solution in original post

4 REPLIES 4
arnaudmanir
Frequent Visitor

Thank you, this helped immensely. However it created a new problem. I now have first, second, third funding dates each in its own column which was my objective, however each one is on a different row.

 

How can I merge all rows into one showing the serial number, first funding date, second funding date, etc? I tried different methods to no avail. 

You can use the group by function from the UI and select MAX on the columns you just created. This columns will either have a value or be null. Choosing MAX will select the value. Now you get the output on one line in your table


[Tip] Keep CALM and DAX on.
[Solved?] Hit “Accept as Solution” and leave a Kudos.
[About] Chiel | SuperUser (2023–2) |

Thank you, it worked perfectly! 

ChielFaber
Solution Supplier
Solution Supplier

You probably get the result your looking for when you use group by and an index column to get an index per group.

 

In your use case you get an index per serial number. Look at Radacad's explanation on how to do this;

https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

 

After this step you can use the if function to fill the columns. For example

 

If index = 1 then initial‐funding date else null

 

Second funding date column will be

 

If index = 2 the initialfundingdate else null

 

 

 

 


[Tip] Keep CALM and DAX on.
[Solved?] Hit “Accept as Solution” and leave a Kudos.
[About] Chiel | SuperUser (2023–2) |

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.