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
Sibrulotte
Helper IV
Helper IV

Counting customers that have an order after completing a request form

Hi, 

I can't share a full model but a 5 line example of 3 tables should do the trick:

 

Customers:

Customer IDCustomer Name
1John

2

Gary

3

Sally

4

Maude

5

Claude

 

Oders:

Order_IDCustomer IDOrder Date
CO-112023-12-01
CO-212024-01-15
CO-332024-01-25
CO-442023-10-01
CO-552024-02-14

 

Forms:

Form_idCustomer IDForm Date
F-112024-01-01
F-222023-12-01
F-342024-01-01
F-442024-02-01
F-552023-12-01

 

I'm trying to count the number of customers that have orders that came in after a request was filed.

Result would be 

3 since only customer 1, 4 and 5 have orders coming after a request form.

 

Any answers help, thank you.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column fomula in the Orders Table

Earliest form date = CALCULATE(MIN(Forms[Form Date]),FILTER(Forms,Forms[Customer ID]=EARLIER('Order'[Customer ID])))

Write this measure

Measure = CALCULATE(DISTINCTCOUNT('Order'[Customer ID]),FILTER('Order','Order'[Order Date]>'Order'[Earliest form date]&&'Order'[Earliest form date]<>BLANK()))

Ashish_Mathur_0-1708313776546.png

 


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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column fomula in the Orders Table

Earliest form date = CALCULATE(MIN(Forms[Form Date]),FILTER(Forms,Forms[Customer ID]=EARLIER('Order'[Customer ID])))

Write this measure

Measure = CALCULATE(DISTINCTCOUNT('Order'[Customer ID]),FILTER('Order','Order'[Order Date]>'Order'[Earliest form date]&&'Order'[Earliest form date]<>BLANK()))

Ashish_Mathur_0-1708313776546.png

 


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

Thank you Anish, I see the goal and the path, but I somehow have a circular dependency from that column. 

 

My model is many to one from orders to customer and many to one from forms to customer.

You are welcome.  My solution does not require any relationships.  The ones that you have created are causing the error.  Please review them.


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

I in deed had to remove the relationshop to a single way...

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.

Top Solution Authors
Top Kudoed Authors