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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BTLYBSCT
Regular Visitor

DAX - Getting a value based off the earliest and latest dates

Hi All,

 

I have a report that produces once a month and with every report I receive the same data set with a few new rows.

 

I have created a field for Month/Year so I can keep track of the increase and a value of a column "Contract Status" can change.

 

What I am trying to do is evaluate what the Contract Status was when it first came to the report and check what the contract status is after 6 months.

 

I have created two calculated columns

 

Earliest Date = CALCULATE(MIN('CCO Impairment_Asset_View'[Month/Year]), FILTER('CCO Impairment_Asset_View', 'CCO Impairment_Asset_View'[Contract No]=EARLIER('CCO Impairment_Asset_View'[Contract No])))

This one gives me the first date the contract number came into the report

 

Latest Date = DATEADD('CCO Impairment_Asset_View'[Earliest Date],6,MONTH)

Second one provides the date 6 months from the earliest date.

 

Now I am trying to find the value for Contract Status at the time it came in from the earliest and what the code is in the latest.

 

I have tried different methods and I seem to be stuck on this.

 

Any assistance would be greatly appreciated.

 

Thanks!

1 ACCEPTED SOLUTION

Hi All,

 

I have been able to solve this through sing the formula below.

 

ED Contract Status = 
CALCULATE(MAX('CCO Impairment_Asset_View'[Contract Status]),FILTER('CCO Impairment_Asset_View','CCO Impairment_Asset_View'[Contract No] = EARLIER('CCO Impairment_Asset_View'[Contract No]) && 'CCO Impairment_Asset_View'[Month/Year] = earlier('CCO Impairment_Asset_View'[Earliest Date])))

Hopefully this will be able to help someone in the future.

View solution in original post

3 REPLIES 3
PattemManohar
Community Champion
Community Champion

@BTLYBSCT Please provide the sample data and expected output which will be really helpful.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Apologies @PattemManohar, please see an example below.

 

 

MnthContract NumberContract Status
Feb-18003-111111-0007
Dec-17003-111111-0006


The above example shows that in Decemember when the contract came into the report it was flagged a contract status of 6. For the reports until Feb the data was showing the same until when the Feb one came through it was showing 7.

 

I would like to pick up the earliest contract status when a contract came into the account and then pick up any changes using my latest date forumula which would pick up the status of that code 6 months after the first date it came in.

 

Hope this is clear.

 

Thanks.

 

Hi All,

 

I have been able to solve this through sing the formula below.

 

ED Contract Status = 
CALCULATE(MAX('CCO Impairment_Asset_View'[Contract Status]),FILTER('CCO Impairment_Asset_View','CCO Impairment_Asset_View'[Contract No] = EARLIER('CCO Impairment_Asset_View'[Contract No]) && 'CCO Impairment_Asset_View'[Month/Year] = earlier('CCO Impairment_Asset_View'[Earliest Date])))

Hopefully this will be able to help someone in the future.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.