Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

bar chart for sales with 5 latest dates

Hi,

I have a Datefield called Date_D, Now I want a bar chart for sales, where my X axis will have 5 latest dates...Please note, the most recent date could be any date  (it may be Yesterday date or any other date)...and something like Today()-5 wont work in my case as no regular interval is there..

Thanks in Advance !!!

Sid

7 Replies
sushil353
Master II
Master II

Hi,

Simply add a set analysis in your expression like below:

sum({<Date_D={">=$(=Max(Date_D)-4)"}>}sales)

HTH

Not applicable
Author

Thanks Sushil,

I am ok with Max(Date_D but then '-4' will be not a  dynamic expression as I am not sure that last 4 dates will fall in Max(Date_D)_-4 Range.

for example: if My max date is say 8th July 2016 then expression will give me dates from 4th July to 8th July.

I want last 4 dates available in my column. they could be say 8thjuly2016, 6th July2016,5th July 20162nd July2016.

Regards

Sid

sunny_talwar

I would further suggest adding a date function to this:

Sum({<Date_D={">=$(=Date(Max(Date_D)-4, 'DateFieldFormatHere'))"}>}sales)

Not applicable
Author

Hi Sunny, Thanks for your suggestion. Please let me again reframe my query, Its NOT the last consecutive 4 days but I guess what I want is top 5 dates (they may not be Consecutive).

Please suggest some solution to this problem.

Regards

Sid

sunny_talwar

Try this then...


Sum({<Date_D={">=$(=Date(Max(Date_D, 5), 'DateFieldFormatHere'))"}>}sales)


Here Max(Date_D, 5) will give you your 5th largest available date and all the dates above that date

sunny_talwar

or this if you always want to see top 5 dates regardless of any selection

Sum({<Date_D={">=$(=Date(Max({1}Date_D, 5), 'DateFieldFormatHere'))"}>}sales)

Not applicable
Author

Now I realize how help this expression is , you have answered my next problem in advance !!! ..Expression that populate value rerardless any selection is what I was abut to seek...

Many Thanks Sunny  !!!