Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
subbareddykm
Creator II
Creator II

Help

Hi I Have below data line below,

i Want to craete two columns in stright table Current and Last year.

ex:If i select 2016/17  Current is Year is :2016/17 's data and Last Year 2015/16 's data.

How can i create using this This kind of year.Please help me on this.

LOAD * INLINE [

    Year, Data, ID

    2011/12, 23422, 1

    2012/13, 43512, 1

    2013/14, 4522, 1

    2014/15, 43523, 1

    2015/16, 56345, 1

    2016/17, 34345, 1

    2011/12, 234, 2

    2012/13, 435, 2

    2013/14, 2232, 2

    2014/15, 42, 2

    2015/16, 324, 2

    2016/17, 45234, 2

    2011/12, 4352, 3

    2012/13, 452, 3

    2013/14, 532, 3

    2014/15, 452, 3

    2015/16, 534, 3

    2016/17, 563,3

];

1 Solution

Accepted Solutions
sunny_talwar

Try making selection in ReportYear

Capture.PNG

View solution in original post

7 Replies
agustinbobba
Partner - Creator
Partner - Creator

Hi!,

Try this..

Table:

Load

  Year                AS Actual_Year,

  Data                AS Actual_Data,

  ID                  AS Actual_ID,

  Previous(Year)      AS Last_Year,

  Previous(Data)      AS Last_Data,

  Previous(ID)        AS Last_ID

Resident Aux

;

Regards!

Agustin

salto
Specialist II
Specialist II

Hello,

In the inline, is there any chance of setting the Year as 2011 instead of 2011/12? That would ease the operations of adding / substracting years and therefore it would be easier to obtain the data the way you need.

subbareddykm
Creator II
Creator II
Author

yes, But usser going select this kind of year only. But as per ur choice i ll just take right side two latters.if i use that in expression will it give same data based on my selectoons?

I want dim ID

Can u tell me how to do this?

sunny_talwar

May be using LinkTable approach

Table:

LOAD Year,

  Data,

  ID,

  Left(Year, 4) as LINK

INLINE [

    Year, Data, ID

    2011/12, 23422, 1

    2012/13, 43512, 1

    2013/14, 4522, 1

    2014/15, 43523, 1

    2015/16, 56345, 1

    2016/17, 34345, 1

    2011/12, 234, 2

    2012/13, 435, 2

    2013/14, 2232, 2

    2014/15, 42, 2

    2015/16, 324, 2

    2016/17, 45234, 2

    2011/12, 4352, 3

    2012/13, 452, 3

    2013/14, 532, 3

    2014/15, 452, 3

    2015/16, 534, 3

    2016/17, 563,3

];

LinkTable:

LOAD Year as ReportYear,

  LINK,

  'CY' as Flag

Resident Table;

Concatenate(LinkTable)

LOAD Year as ReportYear,

  LINK + 1 as LINK,

  'PY' as Flag

Resident Table;


Capture.PNG

salto
Specialist II
Specialist II

My approach (not as a good as the below one;)

subbareddykm
Creator II
Creator II
Author

Hi Sunny,

Its not working , If i make any selection :its show same values for both.

Check below scren

Issue_Max.PNG

sunny_talwar

Try making selection in ReportYear

Capture.PNG