LOAD * INLINE [
Room Expenditure, 700
Telephone Expenditure, 500
Room Profit, 400
Telephone Profit, 100
load 'Room Cost' as Type,
sum(if(Type='Room Expenditure', Value, if(Type='Room Profit',-Value,0 ))) as Value
load 'Telephone Cost' as Type,
sum(if(Type='Telephone Expenditure', Value, if(Type='Telephone Profit',-Value,0 ))) as Value
See attached qvw
comm89857.qvw 132.0 K
If you don't have any field to group all the different types, you need one. Try creating a new field with this:
SubField(Type, ' ', 1) as NewType, // For differenciating Telephone, room,...
SubField(Type, ' ', 2) as DataType // For differenciating Expenses, cost...
Once you have this new fields, it will be easy to achieve what you want, just following what Wassennar posted.