Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Calculating differences based on row values

Hi folks,

Please view the image below before hand:

Recurring-New.jpg

I would like to know how I could calculate the difference based on the values of the rows. What I mean here is, for e.g. IF I wanted to calculate the difference between the no. of users for 2/2014 and 1/2014, how could i do so? Derive the value of the current month minus its previous month.

Thanks in advance.

Best Regards,

R

1 Solution

Accepted Solutions
MVP
MVP

Re: Re: Re: Calculating differences based on row values

May be like attached sample

8 Replies
MVP
MVP

Re: Calculating differences based on row values

Try with above()/below() functions. If any doubt, try to share a sample qvw and explain expected output there.

Not applicable

Re: Calculating differences based on row values

Hi tres,

Will try it out and get back to you on that. Thanks.

Not applicable

Re: Re: Calculating differences based on row values

Hi tres,

Attached herewith is a sample .qvw.

Please do have a look at it, I have placed a comment in the script to explain what is my desired results

Cheers

Not applicable

Re: Re: Re: Calculating differences based on row values

Hi Ram,

PFA....

Regards

Ankur

MVP
MVP

Re: Re: Re: Calculating differences based on row values

May be like attached sample

MVP
MVP

Re: Calculating differences based on row values

Check enclosed file...

Not applicable

Re: Re: Calculating differences based on row values

Thanks tres!

Not applicable

Re: Calculating differences based on row values

Hi Ram,

You can Use this script to derive difference between no. of users for current month minus Previous month.

Source :

LOAD * INLINE [

    Year, Quarter, MonthOfYear, UniqueChargedUsers

    2012, 2, 5, 22030

    2013, 4, 12, 58521

    2014, 1, 1, 72378

    2014, 1, 2, 52969

   

];

NoConcatenate

Source1:

Load *

Resident Source

Order by Year, MonthOfYear;

Drop Table Source;

Source2 :

Load

Year,

MonthOfYear,

UniqueChargedUsers,

if((Year = Peek(Year) and MonthOfYear = Peek(MonthOfYear) + 1 ) or(Year = Peek(Year) + 1  and  MonthOfYear = 1 and Peek(MonthOfYear) = 12 ),UniqueChargedUsers-Peek(UniqueChargedUsers)) as DiffrenceOfCurrentAndPreviousMonth

Resident Source1;

Drop Table Source1;

Result will be like this.

1.png

Regards,

Vivek

Community Browser