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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
padmanabhan_ram
Creator II
Creator II

Previous value of a selected Week

Hi All,

I am trying to get the previous volume value of the selected week in a single row.

If I select '08/28/15' week, in the chart I should see the volume of '08/28/15' and volume of previous 4x4 week'07/31/15' in  a single row.

Note: week values are '4x4' weeks i.e. variation between each value is 4 week.

Please find the attached qvw.

Thanks in advance,

Padmanabhan

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Data:

LOAD

  AutoNumber(Week) as WeekID,

  *

INLINE

[

  Week, Volume

  09/26/14, 344

  10/24/14, 546

  11/21/14, 643

  12/19/14, 876

  01/16/15, 1234

  02/13/15, 6754

  03/13/15, 2345

  04/10/15, 768

  05/08/15, 879

  06/05/15, 986

  07/03/15, 111

  07/31/15, 3278

  08/28/15, 7689

];

Temp:

Mapping Load WeekID, Volume Resident Data;

Final:

Load *, ApplyMap('Temp',WeekID-1, 0) as PreviousWeekVolume Resident Data;

Drop Table Data;

Now use below expressions

sum(Volume)

SUM(PreviousWeekVolume)

View solution in original post

4 Replies
MK_QSL
MVP
MVP

Data:

LOAD

  AutoNumber(Week) as WeekID,

  *

INLINE

[

  Week, Volume

  09/26/14, 344

  10/24/14, 546

  11/21/14, 643

  12/19/14, 876

  01/16/15, 1234

  02/13/15, 6754

  03/13/15, 2345

  04/10/15, 768

  05/08/15, 879

  06/05/15, 986

  07/03/15, 111

  07/31/15, 3278

  08/28/15, 7689

];

Temp:

Mapping Load WeekID, Volume Resident Data;

Final:

Load *, ApplyMap('Temp',WeekID-1, 0) as PreviousWeekVolume Resident Data;

Drop Table Data;

Now use below expressions

sum(Volume)

SUM(PreviousWeekVolume)

padmanabhan_ram
Creator II
Creator II
Author

Thanks for the response Manish.

But the Weeks are repeated they are not unique every time. Each week will have more than one entry, in that scenario there will be more than one WeekID will be created for a Week.

Thanks,

Padmanabhan

MK_QSL
MVP
MVP

Provide data with repeat week. I will do it for you...!

padmanabhan_ram
Creator II
Creator II
Author

Hi Manish,

Thank you, I did created a week field with distinct value and then used it to create auto number and it worked.

Thanks and regards,

Padmanabhan