Qlik Community

Ask a Question

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 
Search instead for 
Did you mean: 
Ari_vzla
Contributor III
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

=sum({<Mes = {">=$(=MonthStart(AddMonths(Today(),-0)))<= $(=MonthEnd(AddMonths(Today(),-0)))"}>}[Picking mensual])

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
sunny_talwar

@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])

 

View solution in original post

6 Replies
Chanty4u
Champion III
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])

Ari_vzla
Contributor III
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 

Chanty4u
Champion III
Champion III

can you paste your date format please?

 

Ari_vzla
Contributor III
Contributor III
Author

Sure, there yo go 

'DD.MM.YYYY';

Thank you 

Arieli 

sunny_talwar

@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])

 

View solution in original post

Ari_vzla
Contributor III
Contributor III
Author

Thank you so much, it works