- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yangadounb
Explorer
08-23-2022
07:32 AM
I have the record like this:
_time id status
1 x yes
1 x no
2 x yes
1 x unknow
I want to return the record based on status value: if status has yes ,then return the lasted row that has yes. if there is none yes value then I want the row with no, if there is none yes or none no, return unknow row.
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ITWhisperer

SplunkTrust
08-23-2022
08:09 AM
| eval stat=case(status="yes",0,status="no",1,status="unknow",2)
| sort 0 stat - _time
| head 1
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yangadounb
Explorer
08-23-2022
09:01 AM
_time id status
1 x yes
1 x no
2 x yes
1 x unknow
1 y yes
1 y no
2 y yes
1 y unknow
2 z yes
1 z unknow
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ITWhisperer

SplunkTrust
08-23-2022
09:29 AM
| eval stat=case(status="yes",0,status="no",1,status="unknow",2)
| sort 0 stat - _time
| streamstats count by id
| where count = 1
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ITWhisperer

SplunkTrust
08-23-2022
08:09 AM
| eval stat=case(status="yes",0,status="no",1,status="unknow",2)
| sort 0 stat - _time
| head 1
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yangadounb
Explorer
08-23-2022
09:03 AM
sorry not to make this clear , I have more records than that.
