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

aggr result in a text box

Hello All,

Below is the scenario

There is a date field D1. Each record is to be subtracted from today() and the difference is to be summed up.

The sum is to be shown in a text object.

Please help with the possible solution

Regards,

Priya

11 Replies
arulsettu
Master III
Master III

hi

in text object add like this

=sum(filed)

Not applicable
Author

Hi Arul

Value in need is the sum of all the differences for each date value.

To be more clear,

D1

5th Jan

6th Jan

today() - 20th Jan

difference

15

14

sum of difference is 29

if we use only sum(difference) we dont get a value.

Thanks.

arulsettu
Master III
Master III

can you sample source like excel

arulsettu
Master III
Master III

i am getting 29 see this

Capture.JPG

Not applicable
Author

Hi,

There is just one column as a source

it is a date value

Load * inline

[

D1

5/1/2015

6/1/2015

];

today() is a function in qlikview which results today's date.

D1-today() is to be calculated and the sum of the difference is to be shown in a text object.

Not applicable
Author

Hi

Please note that, today() is not to be used inside script, since we wont get the real time value unless it is reloaded.

we want to write the expression in UI.

its_anandrjs

Hi,

Then in any text box write

=Sum( Interval(Today() - D1,'D') )

Also you can create the field in the load script

Ex:-

LOAD Interval(Today() - D1,'D')  as Diff,*;

LOAD Date(Date#(D1,'DD/MM/YYYY'),'DD/MM/YYYY') AS D1;

Load * inline
[
D1
5/1/2015
6/1/2015
]
;


And then use

Sum(Diff)

Regards

Anand

Anonymous
Not applicable
Author

hi try like this

sum(day(Date(filed)))

its_anandrjs

Hi,

Then you have to use only this expression

=Sum( Interval(Today() - D1,'D') )


This gives 29 if you have two dates only


Regards

Anand