Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
You need to structure the excel database differently, see attached.
You can then load the script as follows
LOAD Year,
Month,
Actual,
Budget1,
Budget2,
Budget3,
Budget4,
if(Budget4 <> 0, Budget4, if(Budget3<>0,Budget3,if(Budget2<>0,Budget2,Budget1))) as Budget
FROM
For the chart or report the expression will be
=Sum(Actual- Budget)
If you need to keep the excel database in it's existing format then you use the following
Table_Temp:
LOAD Year,
ID,
Name,
Month,
Value
FROM
Table:
NOCONCATENATE LOAD Year,
Month,
ID,
sum(if(Name like '*Actual*',Value)) as Actual_Val,
sum(if(Name like '*Budget1*',Value)) as Budget1_Val,
sum(if(Name like '*Budget2*',Value)) as Budget2_Val,
sum(if(Name like '*Budget3*',Value)) as Budget3_Val,
sum(if(Name like '*Budget4*',Value)) as Budget4_Val
RESIDENT Table_Temp
Group By Year, Month, ID;
DROP TABLE Table_Temp;
The expression in the chart or the report will be
=if(Budget4 <> 0, Budget4, if(Budget3<>0,Budget3,if(Budget2<>0,Budget2,Budget1)))
Hi,
might then make sense, if you have a look into the CROSSTABLE-functionality of QlikView.
Your may give it a try with the below script:
Budget:
CROSSTABLE(Item, Value, 2)
LOAD
*
FROM
[.\DB1.xls]
(biff, embedded labels, table is Sheet1$)
WHERE
Year <> 'Total';
HTH
Peter