Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
punitpopli
Specialist
Specialist

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
Anonymous
Not applicable

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

Anonymous
Not applicable

find working file

saumyashah90
Specialist
Specialist

Did you want this?

ecolomer
Master II
Master II

You can use also INTERVALMATCH function

preminqlik
Specialist II
Specialist II

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
Specialist
Specialist
Author

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
Specialist II
Specialist II

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
Master II
Master II

You can use some Variables to store formulas

beskqlik
Contributor II
Contributor II

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