Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression for previous month

  I need the expression for previous month using set analysis............ I have the expression for it which is MonthName(AddMonths(Today(),-1)) but i need it in set analysis..........thnx in advance.........

9 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Use as it is

     Sum({<MonthYearFieldName={'$(= MonthName(AddMonths(Today(),-1)))'}>} Sales)

     MonthYearFieldName is the Field you created using MonthName function in the load script.

Celambarasan

Anonymous
Not applicable
Author

Hi

     Hope the following attached file will be helpful for your problem

Regards

Ashok

Not applicable
Author

Thanx for reply Celam........... I m using this expression for fetching the data for previous month...........but it is not giving the result............so i thought to use set analysis............. The expression is   if(MonthName(AddMonths(Today(),-1))=TIME_FRAME.TIME_FROM,RULES_SPECIAL.FACTOR_VALUE)............Can u suggest me something on this..............

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     The expression should be

     Sum({<TIME_FRAME.TIME_FROM={'$(=MonthName(AddMonths(Today(),-1)))'}>} RULES_SPECIAL.FACTOR_VALUE)

Before that What type data in the TIME_FRAME.TIME_FROM field?

Celambarasan

Not applicable
Author

thanx for reply........ TIME_FRAME.TIME_FROM  is date in format mm/dd/yyyy............

Not applicable
Author

the above expression is not working.......... I need to just show the data related the previous month............

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try with this

     Sum({<TIME_FRAME.TIME_FROM={">=$(=MonthStart(Today(),-1))<=$(=MonthEnd(Today(),-1))'}>} RULES_SPECIAL.FACTOR_VALUE)

Celambarasan

Not applicable
Author

Hi celam..........

the RULES_SPECIAL.FACTOR_VALUE  contains Factor: 0.2 types entities.........i can't use SUM there.........so suggest something beside from sum...............thanx for reply

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Ok then you have to try with

     MaxString,MinString,Only,Concat functions

     Use this

     =MaxString({<TIME_FRAME.TIME_FROM={">=$(=MonthStart(Today(),-1))<=$(=MonthEnd(Today(),-1))'}>} RULES_SPECIAL.FACTOR_VALUE)

Celambarasan