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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How Convert Record To Column and Calculate Difference

hello Dears

i have One Table Look Like

Table01.png

I would like to give the following

Table.png

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

This looks good (Just need a better sorting):

Capture.PNG

Script:

Table:

LOAD * Inline [

Year, Value

2005, 10

2006, 20

2007, 30

2008, 40

];

Concatenate (Table)

LOAD If(Previous(Year) > 0, Year & '-' & Previous(Year)) as Year,

  If(Previous(Value) > 0, Value - Previous(Value)) as Value

Resident Table;

View solution in original post

6 Replies
sunny_talwar
MVP
MVP

Check 'Horizontal' on the Presentation tab:

Capture.PNG

Miguel_Angel_Baeyens
Support
Support

Hi,
GENERIC LOAD is likely what you are looking for. See here for more info:

The Generic Load

How convert table from rows to columns

Miguel

sunny_talwar
MVP
MVP

Just realized that you need to calculate delta also. It will be easy to add a value for change in the script. A script based solution works?

Not applicable
Author

Thanks How To Calculate Automatic Difference

2005-2006

2006-2007

2007-2008

...

Not applicable
Author

yes

but years is dynamic 2005,2006,2007,?

sunny_talwar
MVP
MVP

This looks good (Just need a better sorting):

Capture.PNG

Script:

Table:

LOAD * Inline [

Year, Value

2005, 10

2006, 20

2007, 30

2008, 40

];

Concatenate (Table)

LOAD If(Previous(Year) > 0, Year & '-' & Previous(Year)) as Year,

  If(Previous(Value) > 0, Value - Previous(Value)) as Value

Resident Table;