Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

punitpopli
Contributor III

Class function on date

Hi All,

I am having a requirement to group date in the group of 4 (for e.g.), I am achieving this using class function as : Class(Date,4,'x').

But the calculated dimension giving the result in numbers as 41920<=x<41924 (highlighted with purple in screen shot below). Can we convert the result in numbers to Date?

Attached is the sample spreadsheet for your reference.


Thanks in advance


Punit

10 Replies
balkumarchandel
Valued Contributor II

Re: Class function on date

Just replace your expression with =date(class(WeekEndingDate,4,'x'))

balkumarchandel
Valued Contributor II

Re: Class function on date

find working file

saumyashah90
Valued Contributor

Re: Class function on date

Did you want this?

ecolomer
Honored Contributor II

Re: Class function on date

You can use also INTERVALMATCH function

preminqlik
Valued Contributor II

Re: Class function on date

hi try this

=date(subfield(class(WeekEndingDate,4,'x'),'<= x <',1),'DD/MM/YYYY') &'<= x <' &date(subfield(class(WeekEndingDate,4,'x'),'<= x <',2),'DD/MM/YYYY')

punitpopli
Contributor III

Re: Class function on date

Hi PREMinQLIK,

Is their a way to replace "x" with the actual date in the middle of the range like :

23/12/2014 <= 26/12/2014 < 27/12/2014 ? as 26/12/2014 is the actual date.

Please let me know if you have implemented.

Thanks in advance

Punit

preminqlik
Valued Contributor II

Re: Class function on date

hi there, try this,, you need to playaround with subfield or replace or findoneof()

=date(subfield(class(WeekEndingDate,4,WeekEndingDate),' <= ',1),'DD/MM/YYYY') &' <= ' &

date(subfield(subfield(class(WeekEndingDate,4,WeekEndingDate),' <= ',2),' < ',1),'DD/MM/YYYY')

&

' < '&date(subfield(class(WeekEndingDate,4,WeekEndingDate),' < ',2),'DD/MM/YYYY')

/*

@premhas

ecolomer
Honored Contributor II

Re: Class function on date

You can use some Variables to store formulas

beskqlik
New Contributor II

Re: Class function on date

By using the expression, can we get only last 90 dates data and use this expression on that data.