0 Replies Latest reply: Sep 25, 2014 1:03 PM by Wagner Morandi RSS

    Aggr with previous months

    Wagner Morandi

      Hello !


      I need to insert a set analysis showing last 3 months, but i use aggr function in it.




      DISTINCT Aggr(if(((Sum(QtdeOcorFSP) + Sum(QtdeOcorOESP)) = 0),nCdDistribuidor_RabRoteiro),nCdDistribuidor_RabRoteiro, MesAno_RABRoteiro))


      So what i want is :

      if the sum of QtdeOcorFSP and QtdeOcorOESP is 0, then, i count nCdDistribuidor_RabRoteiro, using aggr MesAno_RABRoteiro and nCdDistribuidor_RabRoteiro as Dimensions.


      I've inserted set analysis before "distinct", but if i select the month, dont bring me last 3 months, because i'm grouping by my dimension MesAno_RABRoteiro .


      But i need to see this with last 3 months of maxDate. If i select september, it will show jul, ago and sep. If select ago, show ago, jul, and jun.


      I'm using a pivot table with MesAno_RABRoteiro and affiliate as dimension. Have just 1 expression, which i've explained.


      Thanks !