Forum Discussion
DAX Last Record Value
Hello Everyone,
How could I write a DAX expression with existing columns (Date, Product, Value) to generate a new column (Last Record)?
Basically, it is taking the last Value for a Product and placing it in every value for Last Record corresponding to that Product.
Thanks in Advance!
Matren
7 Replies
- ThxAlotSuper User
- lbendlinSuper User
Slight variation:
Last = SELECTCOLUMNS(INDEX(-1,ALL('DATA'),PARTITIONBY([Product]),MATCHBY([Date])),[Value])
- lbendlinSuper User
Does it have to be DAX or is Power Query an option too?
- MatrenFrequent Visitor
Hi lbendlin,
I need to create a new column (Last Record) so I can display it in a report showing sparklines which display the value for my company's products. These values go up and down throughout the year and I want to show the latest value with a sparkline that shows the trend over time. In order to do the sparkline, it asks for the value to be summarized as a (sum, minimum, maximum, count, median, variance, etc) -- but no last value.
I wish to generate a new column (Last Record) with the values shown in the screenshot of the spreadsheet. However this is done (i.e using DAX or Power Query) doesn't matter as long as it works and isn't hard-coded.
Thanks,
Matren