Splunk Search

Having sum function issues after entering multiple names on index

nsantiago17
Explorer

Hi,
I'm having a problem trying to sum all the "marcador05" and the others by Country when I put one country name on the index- it works fine, but when I enter more than one it seems like something is wrong, my example below:

(CORRECT)

Country Primeira Semana Segunda Semana  Quinzenal   Terceira Semana Quarta Semana   Fim do Mes
Finland    0                  0              0          0                0              0

(WRONG)

JOB_NAME    Primeira Semana Segunda Semana  Quinzenal   Terceira Semana Quarta Semana   Fim do Mes
Norway    0               0              0          0                 0             0
Finland     1                 0              0          0                 0             0

.

| eval marcador05 = if(COMP_DIA = 01 or COMP_DIA = 02 or COMP_DIA = 03 or COMP_DIA = 04 or COMP_DIA = 05,if(isOutlier = 1,1,0),0)
    | eval marcador10 = if(COMP_DIA = 06 or COMP_DIA = 07 or COMP_DIA = 08 or COMP_DIA = 09 or COMP_DIA = 10,if(isOutlier = 1,1,0),0)
    | eval marcador15 = if(COMP_DIA = 11 or COMP_DIA = 12 or COMP_DIA = 13 or COMP_DIA = 14 or COMP_DIA = 15,if(isOutlier = 1,1,0),0)
    | eval marcador20 = if(COMP_DIA = 16 or COMP_DIA = 17 or COMP_DIA = 18 or COMP_DIA = 19 or COMP_DIA = 20,if(isOutlier = 1,1,0),0)
    | eval marcador25 = if(COMP_DIA = 21 or COMP_DIA = 22 or COMP_DIA = 23 or COMP_DIA = 24 or COMP_DIA = 25,if(isOutlier = 1,1,0),0)
    | eval marcador31 = if(COMP_DIA = 26 or COMP_DIA = 27 or COMP_DIA = 28 or COMP_DIA = 29 or COMP_DIA = 30 or COMP_DIA = 31,if(isOutlier = 1,1,0),0)
    | stats sum(marcador05) as "Primeira Semana", sum(marcador10)  as "Segunda Semana", sum(marcador15)  as Quinzenal, sum(marcador20)  as "Terceira Semana", sum(marcador25)  as "Quarta Semana", sum(marcador31)  as "Fim do Mes" by Country

Can someone help me, and if you have some idea to do the "if loop" better than mine,
please feel free to share.
Thanks

0 Karma
Get Updates on the Splunk Community!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...