Forum Discussion

Bruno_OMB's avatar
Bruno_OMB
Regular Visitor
3 years ago

Problems getting cumulative totals

I'm having trouble getting the cumulative total. I can see the monthly total, but it does not accumulate as I would like. I couldn't find the logic of the thing.
I have the following:

 

Valor por Contencioso =
SUMX(
'table - Fichas (Entrada e Saída)',
[Nº Fichas Contencioso] * 'table - Fichas (Entrada e Saída)'[Valor unitário]
)

 

In the monthly, using dCalendar, it returns the right values, but the Total line brings me the average and not the sum of the total for each month.

The measure "Nº Fichas Contencioso" used above is the following.

Nº Fichas Contencioso =
CALCULATE(
COUNTROWS('table - Fichas (Entrada e Saída)'),
FILTER(
'table - Fichas (Entrada e Saída)',
'table - Fichas (Entrada e Saída)'[Data_Entrada] <= LASTDATE(dCalendario[Data])
&&
('table - Fichas (Entrada e Saída)'[Data_Fim] >= FIRSTDATE(dCalendario[Data])
|| 'table - Fichas (Entrada e Saída)'[Data_Fim] = BLANK())
),
'table - Fichas (Entrada e Saída)'[Materia_Tipo] = 1 || 'table - Fichas (Entrada e Saída)'[Materia_Tipo] = 2,
'table - Contratos'[Ativo] = 1,
'table - Contratos'[Classe_Contrato] = "O",
'table - Fichas (Entrada e Saída)'[Fase_Cod] <> 67 && 'table - Fichas (Entrada e Saída)'[Fase_Cod] <> 101,
'table - Fichas (Entrada e Saída)'[N_Contrato] <> BLANK()
)

 

My result in an array:


Could someone shed some light on what I'm doing wrong?
Thanks for any help.

2 Replies