Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

RubénHPaz
New Contributor III

Sum last n months

Morning... I want to sum last 12 months... I put this expression but don't sum...

 

=Sum({<DocumentoFechaEmision={">=$(=MonthStart(AddMonths(Max(DocumentoFechaEmision),-12)))<=$(=MonthEnd(AddMonths(Max(DocumentoFechaEmision),-1)))"}>}SOLES)

 

DocumentoFechaEmision = The date of the bill, with the month obviously

SOLES = The quantity to sum

 

Please help...

Labels (3)
1 Solution

Accepted Solutions
saminea_ANZ
Contributor

Re: Sum last n months

Can you please check, If there is any problem with date format?

=Sum({<DocumentoFechaEmision={">=$(=Date(MonthStart(AddMonths(Max(DocumentoFechaEmision),-12)),'Your Field Format'))<=$(=Date(MonthEnd(AddMonths(Max(DocumentoFechaEmision),-1)),'Your Field Format'))"}>}SOLES)

1 Reply
saminea_ANZ
Contributor

Re: Sum last n months

Can you please check, If there is any problem with date format?

=Sum({<DocumentoFechaEmision={">=$(=Date(MonthStart(AddMonths(Max(DocumentoFechaEmision),-12)),'Your Field Format'))<=$(=Date(MonthEnd(AddMonths(Max(DocumentoFechaEmision),-1)),'Your Field Format'))"}>}SOLES)