Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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

Tags (1)
7 Replies
sushil353
Honored Contributor II

Re: bar chart for sales with 5 latest dates

Hi,

Simply add a set analysis in your expression like below:

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

HTH

Not applicable

Re: bar chart for sales with 5 latest dates

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

Re: bar chart for sales with 5 latest dates

I would further suggest adding a date function to this:

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

Not applicable

Re: bar chart for sales with 5 latest dates

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

Re: bar chart for sales with 5 latest dates

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

Re: bar chart for sales with 5 latest dates

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

Re: bar chart for sales with 5 latest dates

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  !!!

Community Browser