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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
fazza1991
Helper II
Helper II

Power Query: Min Date of first invoices per customer

Hi ,

 

I am trying to work out the 'POWER QUERY' formula for obtaining the 'First Invoice' date of each customer.

 

DateAccount_IdRevenue
30/04/20211015
30/03/202110155
30/04/20211114
30/04/20211216
29/02/202011122

 

My Table is pretty basic only contains date of invoice, account_id and revenue.

 

I would expect the results to show as :

 

DateAccount_IdRevenueFirst Invoice
30/04/2021101530/03/2021
30/03/20211015530/03/2021
30/04/2021111429/02/2020

30/04/2021

121630/04/2021

29/02/2020

1112229/02/2020

 

I have the DAX formula - but for what i am trying to accomplish i require the Query equivalent.

 

FirstInvoiceDate = CALCULATE(MIN([Date]),ALLEXCEPT([Account_Id]))

 

1 ACCEPTED SOLUTION
HotChilli
Community Champion
Community Champion

Lots of ways to do it.

Using the interface:

Select the Account Id column.

Do a 'Group By' (which will be on Account Id) and choose Advanced with an aggregation of Min on Date and then another on All Rows.

Then Expand the column header from all to return Date and Revenue

View solution in original post

2 REPLIES 2
fazza1991
Helper II
Helper II

Thank you - this worked.

Out of curiousity what other ways could this be done in PowerQueryEditor?

 

HotChilli
Community Champion
Community Champion

Lots of ways to do it.

Using the interface:

Select the Account Id column.

Do a 'Group By' (which will be on Account Id) and choose Advanced with an aggregation of Min on Date and then another on All Rows.

Then Expand the column header from all to return Date and Revenue

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.