I need help on Dax to create measure to find last value by date.
I have
1-a data table
2-a Unique names Table
and
3-the calendar table is in Data model.
Relationship is created in data model between
1-Date field in Data Table and Calendar
2-between Names field in Names table and Data Table.
I need to create a date-wise pivot table with quantity and cost fields in which i need the last cost value for null quantity / cost dates.
I have created one measure
=CALCULATE(Query1[Sum of Cost], LASTDATE('Calendar'[Date]))
but not working for blank quantity dates.
I have created another measure with dax
=IF ( HASONEVALUE ( Query2[Name] ), VAR vItem = VALUES (Query2[Name]) VAR vLastDate = MAX ( 'Calendar'[Date] ) RETURN CALCULATE( Max ( Query1[Cost] ), 'Calendar'[Date] <= vLastDate ))
but it is showing last maximum value instead of last latest value by date.
Bookmarks