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!

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2403! Analysts can ...

Stay Connected: Your Guide to July and August Tech Talks, Office Hours, and Webinars!

Dive into our sizzling summer lineup for July and August Community Office Hours and Tech Talks. Scroll down to ...