Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I want to set my chart to pick the latest date data

Hello,

Find attached, I get data every day and i want the chart to pick the latest data updated everyday. So i wont have to click on date to see current day data.

Rgds

1 Solution

Accepted Solutions
MarcoWedel

Hi,

to still let the chart react to user selections but start with the last date as default selection, you could also add a field selection action to the document's OnOpen trigger:

QlikCommunity_Thread_145687_Pic1.JPG

QlikCommunity_Thread_145687_Pic2.JPG

To do so, I changed your script to load date as a real date instead of text:

load*,

Date#(Year&'/'&Month&'/'&Day,'YYYY/MMM/D') as date;

//SQL SELECT

LOAD

    Actual,

    Day,

    Month,

    Target,

    [PS Status],

    Year

//FROM GMD.dbo.GMD;

FROM (txt, utf8, embedded labels, delimiter is '\t', msq, no eof)

Where Len([PS Status]);

hope this helps

regards

Marco

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Here is what you do.

1. Make the following variables:
          a. vToday  =  today()

          b. vYear    =  Year(vToday)

          c. vMonth  =  Month(vToday)

          d. vDay    =  Day(vToday)

2. Now replace the formula in the chart with this:

          =sum({<Year={$(vYear)},Month={$(vMonth)},Day={$(vDay)}>}Actual)

This is similar to saying that, do sum of Actual where Year= current date Year, Month= Current Month,  Day = Today's day.

After this you will get what you need.
Check the chart to the right of your chart in the attached QVW. Though the date been taken is 2013/04/02 (instead of today's)

Cheers..

maxgro
MVP
MVP

or

Sum({$ <date={"$(=date(Today(), 'YYYY/MMM/D'))"}>}Actual)

Not applicable
Author

Hello,

This is a good one. But most time we have dont have current day data how do we set latest day to show rather than today data.

Rgds

MarcoWedel

Hi,

to still let the chart react to user selections but start with the last date as default selection, you could also add a field selection action to the document's OnOpen trigger:

QlikCommunity_Thread_145687_Pic1.JPG

QlikCommunity_Thread_145687_Pic2.JPG

To do so, I changed your script to load date as a real date instead of text:

load*,

Date#(Year&'/'&Month&'/'&Day,'YYYY/MMM/D') as date;

//SQL SELECT

LOAD

    Actual,

    Day,

    Month,

    Target,

    [PS Status],

    Year

//FROM GMD.dbo.GMD;

FROM (txt, utf8, embedded labels, delimiter is '\t', msq, no eof)

Where Len([PS Status]);

hope this helps

regards

Marco

Not applicable
Author

Hello Macro

Firstly, Almost what i needed but when i click on clear selection it goes.

Secondly, I followed the same step you took but didnt work.

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi Emac4444,

2 things you have to do is:-

1- Set up a variable to pick up lates date (i.e vMaxDate = Date(Max([date])))     

          then in your expression edit it to Sum({<Date = $(vMaxDate)>} Actual).

2- Go to Document Prioperties - Triggers - OnPostReload

          Select in Field

               Field = [date]

          Search String = date= ('$(vMaxDate)')

Hope this helps

Best Regards

Anonymous
Not applicable
Author

Well, he didn't have date in his script. So.