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: 
Anonymous
Not applicable

Difference Between 2 Records in a Field

Hi,

I have 3 fields, Date, Country and TotalPageViews.

The total page views for the same 5 countries are recorded for each day. So, each day has 5 countries, each with 1 page view value.

I would like to create a table that in column1 has date, column 2 has country, column 3 will have the total page views, but column 4 gives the number of new page views for each country for each day i.e. the difference bewteen the total page views on a day and the total page views on the previous day.

So, the table will look something like

Date     Country     Total Views     Daily Page Views

1/9/11   CountryA          50                    50

2/9/11   CountryA          55                    5

3/9/11   CountryA          63                    8

4/9/11   CountryA          70                    7

1/9/11   CountryB          40                    40

2/9/11   CountryB          41                    1

3/9/11   CountryB          49                    8

4/9/11   CountryB          55                    6

4 Replies
swuehl
MVP
MVP

Hi,

You could use chart inter record functions for the Total Views expression:

=rangesum(above(sum([Daily Page Views]),0,rowno()))

Hope this helps,

Stefan

SunilChauhan
Champion
Champion

see the attached filee

hope this help you

Sunil Chauhan
swuehl
MVP
MVP

Ah, you probably want it the other way round, getting the difference, sorry:

=[Total Views]-above([Total Views])

as expression for Daily Page Views?

P.S:

and if you want to have a value for the first row (setting it to current totals):

=if(rowno()>1,sum([Total Views])-above(sum([Total Views])),sum([Total Views]))

SunilChauhan
Champion
Champion

may be thiss one

see the attached filee

Sunil Chauhan