
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Need to subtract within the field
Hi,
i have a situation where i need to subtract within the table and create a new field(Amount).
i should get a new field by subtracting IF - ST as Amount . can you please help me out
ID Type Value
1 ST 30
2 ST 10
3 DP 15
4 IF 20
5 OP 5
6 DP 32


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the expected output you are looking for?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vishwanath,
ID Type Value Amount
1 ST 30 -10
2 ST 10 10
3 DP 15
4 IF 20
5 OP 5
6 DP 32


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this?
LOAD * INLINE [
ID, Type, Value
1, ST, 30
2, ST, 10
3, DP, 15
4, IF, 20
5, OP, 5
6, DP, 32
];
SET vValue = "=Sum({<Type = {'IF'}>}Value)";
Then using Straight table add Dim
ID, Type
Expr: = IF(Match(Type, 'ST'), $(vValue) - Value)


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, try with :
if(Type='ST',sum({<Type={"IF"}>} TOTAL Value) - sum({<Type={"ST"}>} Value))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be this:
ABC:
Load
Id, Type,Value
from ABC;
Let vType = if(Type = "IF",Value);
Noconcatenate
Temp:
Load
*,
If(match(Type,'ST'),$(vType)-Value,0) as Amount
Resident ABC;
Drop table ABC;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if(Type='ST',Value,0) as ST
if(Type='IF',Value,0) as IF
IF-ST as amount
