Forum Discussion
RVLee
4 years agoFrequent Visitor
Dynamic previous year's date
Hi, I would like to calculate previous year's value, but I only get the correct number if I don't apply any slicer or filter. The result I need is in the Total LY or in Total LY exact date colum...
amitchandak
4 years agoSuper User
RVLee , Not sure why you are using max date
Try like
CALCULATE (
lastnonblankvalue ( 'Production'[Production Date],SUM ( 'Contract'[Amount] ) ),
DATESYTD ( SAMEPERIODLASTYEAR ( 'Calendar Date'[Date] ) )
)
Can explain with example what is wrong
RVLee
4 years agoFrequent Visitor
Hi amitchandak
I used max date to get the latest transaction date from Production table, and sometimes the latest transaction date of production in each location is different.
While the amount to sum is in the Contract table, which contains the transaction of contracts of all periods, even future dates.
Both dates have a one-to-many relationship to Calendar table.
Tried your suggestion, however it returns incorrect number. Any other suggestion?
Regards,