Forum Discussion
DAX help
- 8 years ago
Hi alexei7,
That case, please add a [Rank] column first.
Rank = RANKX ( Products, Products[ReportDate],, ASC, DENSE )
Then, modify the formula in original post as below:
Column1 = VAR previousstatus = LOOKUPVALUE ( Products[Status], Products[ProductCode], Products[ProductCode], Products[Store], Products[Store], Products[Rank], Products[Rank] - 1 ) RETURN IF ( previousstatus = BLANK () || previousstatus = "Not Live", "New", BLANK () )Best regards,
Yuliana Gu
Hi v-yulgu-msft,
Thank you for your reply.
Unfortunately this doesnt work - I do need the relationship between the data table and the date dimension table for other calculations in my model/report.
The formula you've provided only takes account of the month number and not the previous month, so if i introduced some more data, i get the following incorrect result:
Here the calculation is taking about only of the month number, so August 2019 is presumed to be before September 2018.
Thanks
Alex
Hi alexei7,
That case, please add a [Rank] column first.
Rank = RANKX ( Products, Products[ReportDate],, ASC, DENSE )
Then, modify the formula in original post as below:
Column1 =
VAR previousstatus =
LOOKUPVALUE (
Products[Status],
Products[ProductCode], Products[ProductCode],
Products[Store], Products[Store],
Products[Rank], Products[Rank] - 1
)
RETURN
IF ( previousstatus = BLANK () || previousstatus = "Not Live", "New", BLANK () )
Best regards,
Yuliana Gu
- alexei78 years ago
Continued Contributor
I haven't tested this as the user changed requirements a little so I ended up solving this a different way.
Cheers for looking into it though.