Qlik Community

Qlik Sense Deployment & Management

Discussion board where members learn more about Qlik Sense Installation, Deployment and Management.

zied_ahmed1
Contributor III

Set Analysis Month -1

Hello I have this set analysis like Month to date :

DateCal=,Year=,Month=,Quarter=,

DateCal={">=$(=MonthStart(max(DateCal)))<=$(=date(max(DateCal)))"}

I would like now to do Month to date -1 (if i select April  2017 i will have March 2017 )

Thanks for help 

omarbensalem

1 Solution

Accepted Solutions
zied_ahmed1
Contributor III

Re: Set Analysis Month -1

Hello,

I find the problem i need to add year=,month = in the variable :

Year=,Month=,DateCal = {"$(='>=' & MonthStart(Max(DateCal),-1) & '<' & MonthStart(Max(DateCal)))"}

14 Replies
MVP
MVP

Re: Set Analysis Month -1

Month=,Quarter=,

DateCal={">=$(=MonthStart(max(DateCal),-1))<$(=MonthStart(max(DateCal)))"}

OmarBenSalem
Esteemed Contributor

Re: Set Analysis Month -1

It should be sthing like:

DateCal={">=$(=MonthStart(max(DateCal),-1))<$(=MonthStart(max(DateCal)))"}


or

DateCal={">=$(=MonthStart(max(DateCal),-1))<=$(=MonthEnd(max(DateCal),-1))"}

zied_ahmed1
Contributor III

Re: Set Analysis Month -1

Hello Stefan,

I used this but it doesn't work

OmarBenSalem
Esteemed Contributor

Re: Set Analysis Month -1

the try :

DateCal={">= $(=addmonths(MonthStart(max(DateCal)),-1))<= $(=addmonths(date(max(DateCal)),-1))"}

Re: Set Analysis Month -1

What date range and format do you see when you add this to a KPI object?

='>=' & MonthStart(Max(DateCal),-1) & '<' & MonthStart(Max(DateCal))

Do you see the >=03/01/2017<04/01/2017 when you select April? and also in the format of your field DateCal?

zied_ahmed1
Contributor III

Re: Set Analysis Month -1

Hello,

Thanks for all,

I don't know why when i try this in text object :

='>=' & MonthStart(Max(DateCal),-1) & '<' & MonthStart(Max(DateCal))

I have the good result :

res1_set_analysis.PNG

But when i put it in variable and i use it in the set analysis like that :

set2.PNG

I have this :

set3.PNG

Re: Set Analysis Month -1

Try with this variable

DateCal = {"$(='>=' & MonthStart(Max(DateCal),-1) & '<' & MonthStart(Max(DateCal)))"}

zied_ahmed1
Contributor III

Re: Set Analysis Month -1

I used this variable :

DateCal = {"$(='>=' & MonthStart(Max(DateCal),-1) & '<' & MonthStart(Max(DateCal)))"}


and this set analysis and I have 0 :


count({<$(var)>}Docs)

Re: Set Analysis Month -1

Can you share an image of chart where you use this expression. Make sure to not label the expression... I would like to see how this get's expanded in the label

Community Browser