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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
allejot
Frequent Visitor

Min and Max Date between two tables

Hi guys, 

 

I am pretty new to DAX and I need a little help in solving an issue. Here my situation:

 

2 tables:

- PROJECT: project ID

- LEDGER LINES: posting date, project id

 

Desired outcome in table PROJECT: project ID, earlest date, latest date

 

I basically want to create 2 calculated columns in table project showing me earliest and latest activity in the project. Any help with the formulas I need for these 2 columns? Thanks!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @allejot,

As per your question I have created the below table.

 

shreyamukkawar_0-1669974091342.png

 

1. Create a new column as 

Earliest date = CALCULATE(Min('LEDGER LINES'[posting date]),FILTER('LEDGER LINES','LEDGER LINES'[Project Id]=project[Project id]))
2. Create a new column as 
Latest date = CALCULATE(MAX('LEDGER LINES'[posting date]),FILTER('LEDGER LINES','LEDGER LINES'[Project Id]=project[Project id]))
 
Results:

 
shreyamukkawar_2-1669974323780.png

 

Best Regards,
Shreya

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

 

View solution in original post

2 REPLIES 2
_MG_
Frequent Visitor

Hi @allejot,

i would recommend creating a relationship between the two tables.

_MG__0-1669975450993.png

After this you can easily create your columns with the earliest and the latest date.
Therfore create a new column in the Project Table. 

EarliesteDate = MINX(RELATEDTABLE('Ledger Lines'), 'Ledger Lines'[PostingDate])
LatestDate = MAXX(RELATEDTABLE('Ledger Lines'), 'Ledger Lines'[PostingDate])
_MG__1-1669975796217.png

 


In this solution you are using something wichich is called "Row context". It is a very import thing within DAX. 
I hope this will help you.
 
Best Regards 
_MG_

 

 

Anonymous
Not applicable

Hi  @allejot,

As per your question I have created the below table.

 

shreyamukkawar_0-1669974091342.png

 

1. Create a new column as 

Earliest date = CALCULATE(Min('LEDGER LINES'[posting date]),FILTER('LEDGER LINES','LEDGER LINES'[Project Id]=project[Project id]))
2. Create a new column as 
Latest date = CALCULATE(MAX('LEDGER LINES'[posting date]),FILTER('LEDGER LINES','LEDGER LINES'[Project Id]=project[Project id]))
 
Results:

 
shreyamukkawar_2-1669974323780.png

 

Best Regards,
Shreya

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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