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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
JPSingh
Frequent Visitor

Earliest date of each stage and the difference in dates between the stages

Each stage has a a number of dates historically. I am trying to get the earliest date each stage so this is all in one line like the 2nd image below. I have only got this by selecting the earliest date but this doesn't help when it comes to calculations I need to do. I ideally need to have every opportunity with the earliest date it went into that stage in one line and then do a calculation to say stage - previous stage. e.g. Engage earliest date - Diagnose earliest date. Do I need to this this in query or can we do this using DAX formula. I have sample data to view if needed but any help would be great

JPSingh_0-1724329060796.png

JPSingh_1-1724329134617.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JPSingh 

Based on your needs, I have created the following table.

vjialongymsft_0-1724374927504.png

In power query, hold down "Ctrl" and select all date rows, then click unpivot column.

vjialongymsft_1-1724375269178.png

 

vjialongymsft_2-1724375306213.png


Then you can use the following dax to get the earliest date.

Measure = MIN('Table'[Value])

 

vjialongymsft_3-1724375458114.png

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
JPSingh
Frequent Visitor

I have managed to resolve the issue through grouping in power query. Thank you for your help 

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


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

Hi @JPSingh 

Based on your needs, I have created the following table.

vjialongymsft_0-1724374927504.png

In power query, hold down "Ctrl" and select all date rows, then click unpivot column.

vjialongymsft_1-1724375269178.png

 

vjialongymsft_2-1724375306213.png


Then you can use the following dax to get the earliest date.

Measure = MIN('Table'[Value])

 

vjialongymsft_3-1724375458114.png

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for this. I think the issue here is that the data I am showing is in DAX. The data is actually already unpivoted however, the issue is I am using salesforce object Opportunity and opportunity history. The Opportunity history has multiple dates under each stage e.g. I could have 4 dates under Diagnose but I need to get the earliest of this date. I have come across another solution in powerquery by grouping that is allowing me to get what I want now but the issue is the calculation of days between

Anonymous
Not applicable

Hi @JPSingh 

Can you provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.

 

 

 

 

 

Best Regards,

Jayleny

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors