Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
inam
Contributor III
Contributor III

last 4 date data

Hello Community,

1) I have raw data 1 to 24 July   i want only last 4 date data 24,23,22,21. if the today date is 26 so my data is 25,24,23,22 and in Total i want  month start to today total data 

2) i am using pivot table and i want to solve this in expression.

inam_0-1690287518330.png

inam_1-1690287895092.png

in Date Created i used below logic but not getting answer

inam_2-1690288047829.png

 

& in expression tab  i used below expression

inam_3-1690288157514.png

 

 

 

 

Labels (1)
10 Replies
BrunPierre
Partner - Master
Partner - Master

Try with this

=Only({$<[Date Created]={">=$(=Date(Max([Date Created])-4,'DD-MM-YYYY'))<=$(=Date(Max([Date Created]),'DD-MM-YYYY'))"}>} [Date Created]))

inam
Contributor III
Contributor III
Author

Hiii @BrunPierre Thanks for reply.

i tried your logic but not getting answer.

inam_0-1690352417681.png

 

inam_1-1690352463595.png

 

BrunPierre
Partner - Master
Partner - Master

My mistake, please try again.

=Aggr(Only({$<[Date Created]={">=$(=Date(Max([Date Created])-4,'DD-MM-YYYY'))<=$(=Date(Max([Date Created]),'DD-MM-YYYY'))"}>}[Date Created]), [Date Created])

inam
Contributor III
Contributor III
Author

same not getting last 4 days date 

inam_0-1690354050572.png

 

BrunPierre
Partner - Master
Partner - Master

Could you post the qvw or some data?

inam
Contributor III
Contributor III
Author

i want last 4 days data and Total is 1st july to last date (25)

PFB qvw

BrunPierre
Partner - Master
Partner - Master

[Date Created] is not properly recognized, use this to interpret it.

Date#([Date Created], 'DD-MM-YYYYY') as [Date Created]

inam
Contributor III
Contributor III
Author

Thanks @BrunPierre  for the help \

Date#([Date Created], 'DD-MM-YYYYY') as [Date Created] ...i try this but get ans ...how i solve this only i want last 4 date data and Total is month start to today date,....any other solution how i solve this ?

BrunPierre
Partner - Master
Partner - Master

BrunPierre_0-1690378647298.png

=Aggr(Only({$<[Date Created]={">=$(=Date(Max([Date Created])-3))<=$(=Date(Max([Date Created])))"}>}[Date Created]), [Date Created])