Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pgalvezt
Specialist
Specialist

Get Previous Month

Hello!!

I have this formula in QlikSense (Bar Chart) :

 

Num(sum({<Mes{'$(=DATE(FLOOR(MonthStart(AddMonths(max(Fecha),-1))),'MMM'))'}>}FieldName),'#.##0')

 

Works Fine!  When I select 2020 May Shows Apr, 2020 Apr Shows Mar and so on,

 

But When I Do Clic in 2020 January QlikSense Shows Me 0 (In December 2019)...

 

What could be?

 

Thanks!!

1 Solution

Accepted Solutions
sunny_talwar

Try this may be

Num(Sum({<Period = {"$(=Date(MonthStart(Max(Fecha), -1), 'MMM-YYYY'))"}, Year, Mes, Fecha>} FieldName), '#.##0')

View solution in original post

4 Replies
sunny_talwar

Do you have a field which shows Month and Year like MonthStart or MonthYear?

pgalvezt
Specialist
Specialist
Author

Hello,

 

Yes I have I field called: Period -> ene-2020, feb-2020, mar-2020.

 

And So on...

sunny_talwar

Try this may be

Num(Sum({<Period = {"$(=Date(MonthStart(Max(Fecha), -1), 'MMM-YYYY'))"}, Year, Mes, Fecha>} FieldName), '#.##0')
pgalvezt
Specialist
Specialist
Author

Great!!