Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
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
tresesco
MVP
MVP

May be like attached sample

View solution in original post

8 Replies
tresesco
MVP
MVP

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

Not applicable
Author

Hi tres,

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

Not applicable
Author

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
Author

Hi Ram,

PFA....

Regards

Ankur

tresesco
MVP
MVP

May be like attached sample

MK_QSL
MVP
MVP

Check enclosed file...

Not applicable
Author

Thanks tres!

Not applicable
Author

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