Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save $200. Learn More
Highlighted
sasiparupudi1
Honored Contributor III

Re: Qlik Sense Comparison to previous period Set analysis

Yes, most likely it is the issue.. LHS and RHS dates must be identical format

What format is [Document Timestamp.autoCalendar.Date]

and what do you see if you put $(vMinDateLastPeriod) in a text box?

masalepp
New Contributor

Re: Qlik Sense Comparison to previous period Set analysis

both are actually YYYY-MM-DD format. So its not an format issue I guess.

Highlighted
sasiparupudi1
Honored Contributor III

Re: Qlik Sense Comparison to previous period Set analysis

Please post a sample

Highlighted
Luminary
Luminary

Re: Qlik Sense Comparison to previous period Set analysis

Hi:

Sometimes I had problems with comparison to previous period Set analysis when I used dates.

I usually use a calculatd field named Period_id to order months in the calendar.

For example:

CALENDAR_TMP:

LOAD

    DISTINCT

       year(date(RecNo()+$(Date)-1,'DD/MM/YYYY'))                                                                                 as "Year",

       month(date(RecNo()+$(Date)-1,'DD/MM/YYYY'))                                                                                as "Month",

       Num(month(date(RecNo()+$(Date)-1,'DD/MM/YYYY')),'00')                                                                      as "NumericMonth",

       capitalize((month(date(RecNo()+$(Date)-1,'DD/MM/YYYY')))&' '&Right(year(date(RecNo()+$(Date)-1,'DD/MM/YYYY')),2))          as "MonthYear",

       year(date(RecNo()+$(Date)-1,'DD/MM/YYYY')) & Num(month(date(RecNo()+$(Date)-1,'DD/MM/YYYY')),'00')                         as "YearMonth"

AUTOGENERATE AddMonths($(sisFechaFin)-$(Date),0);

CALENDAR:

LOAD

       *,

       RowNo()      as Period_id

Resident CALENDAR_TMP

ORDER BY Año, NumMes;

Drop table CALENDAR_TMP;

Now, I can use this field in set analysis:

set vMaxDate = max({<Period_id=max(Period_id)>} Date);

set vMaxDatePrev = max({<Period_id=max(Period_id-1)>} Date);

Best Regards,

Juan P. Barroso

Highlighted
Partner
Partner

Re: Qlik Sense Comparison to previous period Set analysis

Hi all,


When working with Date check on the format. Because the data type returned can change depending on different expression. For example:

today()                   --> Date

today()-1                --> Number

only(InvoiceDate)  --> Date

max(InvoiceDate)  --> Number

Addmonths(....)      --> Date

Today()+14             --> Number

Therefore you may try to use the function date() for this kind of use in set analysis:

Date = {">Date(today() + 12)"}

Regards,

Oktay