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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Mike282
Helper III
Helper III

Determining Date of First Purchase from a List of Payments with payment dates

Hi all,

 

Quick question. Is there a way to determine a date of first purchase based on a list of payments with payment IDs and Customer IDs? 

 

A customer has monthly payments recorded. Each payment has its own unique payment ID, the date of payment, the payment amount and the customer ID.

 

I want to find a way to determine the first time a customer has purchased the product whilst also excluding potential payments of 0 dollars as they might get a free month.

 

Date of First Payment.png

 

I've attached a PBIX file with my sample data 

 

I've tried using a calculated column with the following formula but it's causing a cyclical error. Any help would be greatly appreciated.

 

 

First Purchase Date = CALCULATE(MIN(Payments[Date]),DATESBETWEEN('DateDim'[FullDateAlternateKey],MINX(ALL('DateDim'),'DateDim'[FullDateAlternateKey]),MAX('DateDim'[FullDateAlternateKey])),Payments[Amount]>0)

 

 

1 ACCEPTED SOLUTION

Hi,

This calculated column formula works

Column = [Date]=CALCULATE(MIN(Payments[Date]),FILTER(Payments,Payments[Customer ID]=EARLIER(Payments[Customer ID])&&Payments[Amount]>0))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

I cannot understand the result you want.  Do you want the result to be "Date of first purchase" or some amount.  Please show the exact result you are expecting in a simple Table format.  Once the figures are correct, we can switch the visual to whatever we want.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur 

 

I'm trying to flag the rows that are the first payment date for a specific customer (via the Customer ID). Something similar to the below:

 

Flag First Payment.png

So invoices 6 - 10 would be the date of first payment by the customer ID. Even though the same customers made a payment in June, it was 0 dollars so it isn't flagged as a first payment. Susequently payments for the month of August is flagged as FALSE because their first payment date was in July.

Hi,

This calculated column formula works

Column = [Date]=CALCULATE(MIN(Payments[Date]),FILTER(Payments,Payments[Customer ID]=EARLIER(Payments[Customer ID])&&Payments[Amount]>0))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur Thank you! That worked perfectly!

 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.