Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
torraroger
Contributor III
Contributor III

Expression to get previous month

Hi All, 

I'm bulding a Pivot Table that tells me the monthly Average Elapsed Time of each resource (Workbook). 

I have an option, that displays an arrow pinting up or down depending on an expression. 

I need the expression that tells: 

For each month: If the Average Elapsed Time of the previous month is lower ='fa-arrow-up'

See the picture attached.

 

Thanks.

image.png

Labels (4)
5 Replies
jsteyn
Creator
Creator

Have you tried the Before() chart function?

 

https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/Inter...

 

Expression would be something like:

=if(Avg(Amount) > Before(Avg(Amount)), 'fa-arrow-up', 'fa-arrow-down')

torraroger
Contributor III
Contributor III
Author

It doesn't work...

Thanks!!

jsteyn
Creator
Creator

Can you share your QVF file?

Gui_Approbato
Creator III
Creator III

Hello Torraroger.

Try the expression

 

Avg({<Month={'$(=Month-1)'}>}  value)  --> Considering that the months are numerals. If they are not, use month(date).

 

Eugene007
Contributor
Contributor

Hi Gui

 

Please assist me in the below expression to get previous months values.

SUM({<DateKey = {">=$(=Min({<FYP = {"$(=$(vCurrFYP))"}>} DateKey))<=$(=NUM(Date(vToday)))"}, FinancialCode =- {9999}, ProfitCentreCode = {2}, Date= >} RoomsSold)

 

Kind regards

Eugene