Forum Discussion
Missing "LastNONBLANKVALUE" Dax function.
- 4 years ago
- 4 years ago
Dear Ashish Mathur,
I am simply in awe! Thank you so much! It is going to take me some time to understand why and how this works. Thank You - Thank You!!
Here I was focusing on the one function and you found such an elegant approach. This is so kind of you. I very much appreciate this support. People like you make this such a wonderful community!
Nice solution, Ashish_Mathur. This helped sharpen my understanding of LASTNONBLANK.
In case anyone encounters a performance issue (see link below), here's an alternative approach:
Last Model = CALCULATE ( MIN ( Data[Model] ), Data[Start Date] = MAX ( Data[Start Date] ) )
Last Status = CALCULATE ( MIN ( Data[Status] ), Data[Start Date] = MAX ( Data[Start Date] ) )
The September 2021 release introduced the use of aggregation functions in CALCULATE filters when they are used in Boolean (True/False) expressions. The expression MAX ( Data[Start Date] ) evaluates in the filter context of the visual, resulting in the appropriate date being used for each Location and ID.
https://www.sqlbi.com/articles/optimizing-lastnonblank-and-lastnonblankvalue-calculations/