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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
JamieLee
Frequent Visitor

Difference between dates by earliest date

Hi everyone,

 

Could someone please help me with this:

 

I’m creating a report in which I would like to show the difference in days between the date a product has become available for customers and the date of the first order of that product.

 

In Table ‘Products’, all products are listed once. I would like to add a column to this table called ‘DaysTillOrder’.

In Table ‘Orders’, all orders are listed. A product can be ordered multiple times.

The tables are linked by ProductID.

 

I’ve tried formulas to calculate the difference between dates. What I can’t figure out though, is how to calculate with the first Order date of a product only.

 

I’ve also tried to create a column with the minimum order date per product number as to calculate the difference from there. I ended up with the same minimum order date for every product, so something goes wrong there.

 

So I’m looking for the difference between CreationDate and earliest Orderdate per ProductID in days.

The structure looks like this:

 

Products 
ProductIDCreationDate
00101/01/2018
00201/01/2018
00313/04/2018
00407/06/2018

 

Orders  
OrderIDProductIDOrderDate
02100103/01/2018
02200405/07/2018
02300102/08/2018
02400125/08/2018

Hope someone can help to find a good way to do this. It’s much appreciated!

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

Hi JamieLee,

 

Could you show your expected result or clarify more details about your requirement?

 

Regards,

Jimmy Tao

Hi Jimmy,

 

Thanks for your reaction. The expected result would look like the 3rd column 'DaysTillOrder' in the Products table:

 

Products  
ProductIDCreationDateDaysTillOrder
00101/01/20182
00201/01/2018blank
00313/04/2018blank
00407/06/201831

 

Orders  
OrderIDProductIDOrderDate
02100103/01/2018
02200405/07/2018
02300102/08/2018
02400125/08/2018

 

Product 001, was ordered several times as we can see in the Order table, but the earliest order date was 03/01/2018, so only two days after the CreationDate in the Products table. This is why DaysTillOrder = 2.

Product 002 and 003 have not been ordered, so there is no data to retrieve from the Order table. This returns a blank (or a value like 'not applicable').

Product 004 was ordered slightly over a month after its creation date and is thus returning the value of 31 days.

 

Hope this clarifies?

 

Kind regards,

 

JamieLee

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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