# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for
Did you mean:
Contributor III

## KPI sum the month ago

Hi team,

I am trying to create a KPI with the sum of value of the month ago

But, formula is sum month ago and one month more, this is, sum Aug and Sep. How can I fix it to get only the sum of Aug?

1 Solution

Accepted Solutions
MVP

@Ari_vzla how about this since we are in Oct now and going back to Aug would need going back 2 months

``=Sum({<Mes = {">=\$(=Date(MonthStart(Today(), -2), 'DD.MM.YYYY'))<=\$(=Date(Floor(MonthEnd(Today(), -2)), 'DD.MM.YYYY'))"}>} [Picking mensual])``

6 Replies
Champion III

use this

script create yout

Date(MonthStart(Yourdatefield), 'M-YYYY') as Mes,

frontend:

Sum({<Mes = {"\$(=Date(AddMonths(Max(MonthYear), -1), 'M-YYYY'))"}>}Picking mensual])

Contributor III
Author

Sorry, I am still have an error, scrip show me error after as, but I dont know how fix it

=Date(MonthStart([Mes.autoCalendar.Date]), 'M-YYYY') as Mes

frontend:

=Sum({<Mes = {"\$(=Date(AddMonths(Max(MonthYear), -1), 'M-YYYY'))"}>}[Picking mensual]])

Thank you

Arieli

Champion III

can you paste your date format please?

Contributor III
Author

Sure, there yo go

'DD.MM.YYYY';

Thank you

Arieli

MVP

@Ari_vzla how about this since we are in Oct now and going back to Aug would need going back 2 months

``=Sum({<Mes = {">=\$(=Date(MonthStart(Today(), -2), 'DD.MM.YYYY'))<=\$(=Date(Floor(MonthEnd(Today(), -2)), 'DD.MM.YYYY'))"}>} [Picking mensual])``

Contributor III
Author

Thank you so much, it works