Forum Discussion
sananakbar56
4 years agoFrequent Visitor
Use FIRSTNONBLANK() with String and Date
Hi all, I need help with using FIRSTNONBLANK() sorting a string column by date. Unfortunately, when I sort it by the string, it returns me the min(string) because A is lower than B and B lower than C...
- 4 years ago
Hi sanaankbar56,
I was very clear with your requirement and I have tested it as below.
from above table, the "FirstRetnFruit" is the measure for for it.
The code is as I showed at my previous answer.
Hope this helps you. Thanks
colacan
Resolver II
4 years agoHi sananakbar56,
Please try below code:
FirstReturnProduct =
CALCULATE(
CALCULATE(
FIRSTNONBLANKVALUE(
Fruits[TransactionDate],
SELECTEDVALUE( fruits[Purchase] )
),
ALLEXCEPT( Fruits, Fruits[CustomerID] )
)
Hope this helps you. Thanks
sananakbar56
4 years agoFrequent Visitor
Thankyou for responding. Just to clarify it more, I am looking for cases where the Transaction Type is Return. For example, the earliest return for CustomerID = 1 was 1/2/2021 and the Product was Bananas which is then supposed to appear on the last column. I am looking to get the First Product Returned for each customer ID.