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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register 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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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