Forum Discussion
allejot
3 years agoFrequent 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 outcom...
- Anonymous3 years ago
Hi allejot,
As per your question I have created the below table.
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 asLatest date = CALCULATE(MAX('LEDGER LINES'[posting date]),FILTER('LEDGER LINES','LEDGER LINES'[Project Id]=project[Project id]))Results:Best Regards,
ShreyaAppreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
_MG_
3 years agoFrequent Visitor
Hi allejot,
i would recommend creating a relationship between the two tables.
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])
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.
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_
_MG_