Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have the following table:
Wave | ActivityDate | ContactID | NPSSegment |
---|---|---|---|
1 | 01/01/2018 | A | Neutral |
1 | 01/01/2018 | A | Neutral |
1 | 01/01/2018 | B | Detractor |
1 | 01/01/2018 | C | Promotor |
And the following script:
NPSSegments:
LOAD FirstSortedValue(NPSSegment,-ActivityDate) as NPSSegmentPre,
//avg(round(NPSScore)) as AvgNPSScore,
ContactID
Resident NPSPreload
Where Wave = '0'
Group By ContactID;
For ContactID A, there is no value. For B & C, there is.
The issue I'm having is with the ContactID A.
How can I make the script "pick" one (the latest based on the sorting of the load script) when the activity date is the same?
Now it's just returning nothing.
As always, any help is greatly appreciated!
Kind regards,
Christophe
Try this
FirstSortedValue(DISTINCT NPSSegment,-ActivityDate) as NPSSegmentPre,
Try this
FirstSortedValue(DISTINCT NPSSegment,-ActivityDate) as NPSSegmentPre,
It worked, thanks!
One more thought on this though:
What if one contact has 2 different values on the same day. Which one will it pick? And will it produce the same "issue"?
It will pick on of them randomly. But is there a preference to what should be picked?