Forum Discussion
Tommyvhod
Helper II
6 years agoMultiply colums according latest date
Hi all I would like to create a measure but i am stuck. I have a product, for the product different materials with quantities and unit prices. But in the table I use I have historical data as we...
- 6 years ago
Please use the below logic
(1) Create a calculated column for finding the latest date for each group(Part, mat). If need, you include the qty in the filter clause
Latestdate =CALCULATE(MAX('Table'[date]),FILTER('Table','Table'[Part]=EARLIER('Table'[Part])&&'Table'[Material]=EARLIER('Table'[Material])))(2) Create column Flag for the latest recordFlag = IF('Table'[date]='Table'[latestdate],1,0)Latest record will be flagged as 1 like belowNow, filter out the old record by filtering the flag <>0. Also fetch the cost of latest date by using filter context in CALCULATE functionPlease let me know if this solutions works
Parkavi
6 years agoFrequent Visitor
Please use the below logic
(1) Create a calculated column for finding the latest date for each group(Part, mat). If need, you include the qty in the filter clause
Latestdate =
CALCULATE(MAX('Table'[date]),FILTER('Table','Table'[Part]=EARLIER('Table'[Part])&&'Table'[Material]=EARLIER('Table'[Material])))
(2) Create column Flag for the latest record
Flag = IF('Table'[date]='Table'[latestdate],1,0)
Latest record will be flagged as 1 like below
Now, filter out the old record by filtering the flag <>0. Also fetch the cost of latest date by using filter context in CALCULATE function
Please let me know if this solutions works