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.