Hello, I accepted your suggestion as solution. I would sort by Score if I had Score2 and Score 3 I made some modifications. I used addcoltotals, added "total other", and added Score 2 and S...
See more...
Hello, I accepted your suggestion as solution. I would sort by Score if I had Score2 and Score 3 I made some modifications. I used addcoltotals, added "total other", and added Score 2 and Score 3. The only problem is I don't know where Expense no "21" came from. Can you take a look at my search below and see if it looks correct? Thank you for your help | makeresults format=csv data="Expense,Name,Score,Score2,Score3
1,Rent,2000,20000,200000
2,Car,1000, 10000,100000
3,Insurance,700,7000,70000
4,Food,500,5000,50000
5,Education,400,4000,40000
6,Utility,200,2000,30000
7,Entertainment,100,1000, 10000
8,Gym,70,700,70000
9,Charity,50,500,5000"
| sort 0 -Score
| streamstats count as row sum(Score) as running, sum(Score2) as running2, sum(Score3) as running3
| eventstats count(Name) as total_name, sum(Score) as total, sum(Score2) as total2, sum(Score3) as total3
| where row <= 6
| eval Score=case(row == 6, total - running + Score, true(), Score)
| eval Score2=case(row == 6, total2 - running2 + Score2, true(), Score2)
| eval Score3=case(row == 6, total3 - running3 + Score3, true(), Score3)
| eval other_name_ct = total_name - 5
| eval Name=case(row == 6, "Other(". other_name_ct.")", true(), Name)
| addcoltotals labelfield=Name
| fields - row running running2 running3 total total2 total3