Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count of days

Hi All,


not able to write expression for last 30 days in bar chart, i want that, on first look data come for last 30 days and then on every selection of months its show last 30 days of one months data....


see attachment for details

8 Replies
MK_QSL
MVP
MVP

Can you please explain your requirements in detail?

Anonymous
Not applicable
Author

try

round(today() - date(STEP_START_TIME,'DD/MM/YYYY'),1) as expression.

Not applicable
Author

Hi,

You have a start time, with this kind of format : 9/28/2013 8:13:57 PM

You can get a date like this, for example: date(date#(SubField(STEP_START_TIME,' ',1),'M/D/YYYY'))

Then you get the number of days between this date and today like this:

Today()-date(date#(SubField(STEP_START_TIME,' ',1),'M/D/YYYY'))

Hope this helps

rustyfishbones
Master II
Master II

You could try

2014-04-08_0928.png

Not applicable
Author



not able to write expression for last 30 days in bar chart, i want that, on first look data come for last 30 days and then on every selection of months its show last 30 days of one months data....


see attachment for details

MK_QSL
MVP
MVP

Can you please explain your requirements in detail?

its_anandrjs
Champion III
Champion III

Write a load script like

LOAD APPLICATION_NAME,

     HOST_NAME,

     STEP_NAME,

     SCRIPT_NAME,

     STEP_NUM,

     STEP_START_TIME,

     MONTH,

     TOTAL_STEPS,

     STATUS,

     Duration,

     Today() - Date(Date#(SUBFIELD(STEP_START_TIME,' ',1),'M/D/YYYY')) as STEP_START_TIME_New //For difference

FROM

C:\Users\admin\Desktop\TESTB.xlsx

(ooxml, embedded labels, table is Sheet1);

Regards

Not applicable
Author

In your sample data no STEP_START_TIME is under 30 days from today, so if you try to make a count for the last 30 days you get nothing. Otherwise, to make a count like in the SIMPLE COUNT chart but for last 30 days only, this works:

count({<STEP_START_TIME={"=date(date#(SubField(STEP_START_TIME,' ',1),'M/D/YYYY'))>Today()-30"}>}Duration)

Then, when you select MONTH, you only get 1 result each time. This is because your MONTH field is a date in monthname format, entries are written the same if dates are same month, but each cover a different date.

MONTH is loaded this way:  Date(STEP_START_TIME,'MMMM') AS MONTH,

Load it this way instead: Text(Date(STEP_START_TIME,'MMMM')) AS MONTH,