Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dual lines as one?

Hello,

I am new  to Qlikview and have what is probably a basic question.  How can I join the lines (example data) into one?

Year     Part     Quantity     Revenue

2013     A          10               $100

2012     A          12               $80

I want the end result to look like something like...

Part     Current Year QTY     Prior Year QTY     Current Rev     Prior Year Rev

A          10                              12                         $100               $80

I tried an 'IF' statement but could not get both value to show up unless I had the year field in my table...which I do not want.

Any help would be great.

Thanks,

KMC

3 Replies
eddysanchez
Partner - Creator
Partner - Creator

LET vCurrentYear = Year(Today());

Table:

LOAD Part, Quantity as [Current Year QTY], Revenue as [Current Rev]

Inline [

Year, Part, Quantity, Revenue

2013,     A,          10,               $100

2012,     A,          12,               $80

]

Where Year = $(vCurrentYear);

Left Join(Table)

LOAD Part, Quantity as [Prior Year QTY], Revenue as [Prior Year Rev]

Inline [

Year, Part, Quantity, Revenue

2013,     A,          10,               $100

2012,     A,          12,               $80

]

Where Year = $(vCurrentYear)-1;

Not applicable
Author

Eddy,

Thanks but can I have a little more help?  I believe you are telling me to adjust the way in which I load the data....yes? 

If my load script looks like this. now.... 

SQL

SELECT `Amount - USD`,
`Amount - USD1`,
`Invoice Year`,
`Manufacturing Plant`,
`Part Description1`,
`Part Number`,

What should the script look like if I want the stacked data (2013 and 2012 on different lines) to be combined into one line?

Thanks,

KMC

eddysanchez
Partner - Creator
Partner - Creator

Well, you need to replace

Inline [ ... ] where Year = $(vCurrentYear);

by

SQL

...

WHERE

Year = $(vCurrentYear);

for each year (2013 and 2012)

If you can't solve, send me a image with the data of your sql select