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

Change the Number In Negative

Hi All,

Please help to change the return number in negative.

I applied If(type='Refund',quantity*-1,[quantity]) as Net_Qty,  in Script but not getting the right output

Below are the fields

"type",
"order id",
Sku,
description,
quantity,

These are the data i need as output

type quantity Output Data
Refund 1 -1
Order 1 1
Service Fee 1 1
Adjustment 1 1
Fulfilment Fee Refund 1 1
FBA Inventory Fee 1 1
Tax Withheld 1 1
Transfer 1 1
Labels (5)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@KC3  the syntax is good

this in load script:

LOAD *,if(type='Refund',-1*quantity,quantity) as Net_Qty  INLINE [
    type , quantity
    Refund ,1
    Order ,1
    Service Fee ,1
    Adjustment ,1
    Fulfilment Fee Refund ,1
    FBA Inventory Fee,1
    Tax Withheld,1
    Transfer,1
];

 

output:

 
 

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

6 Replies
Taoufiq_Zarra

@KC3  the syntax is good

this in load script:

LOAD *,if(type='Refund',-1*quantity,quantity) as Net_Qty  INLINE [
    type , quantity
    Refund ,1
    Order ,1
    Service Fee ,1
    Adjustment ,1
    Fulfilment Fee Refund ,1
    FBA Inventory Fee,1
    Tax Withheld,1
    Transfer,1
];

 

output:

 
 

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Taoufiq_Zarra

Taoufiq_Zarra_3-1672389477909.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
KC3
Creator
Creator
Author

Hi,

Not getting it properly

Having  Syn error

PFB image for your refrence

KC3_1-1672390232473.png

 

 

Taoufiq_Zarra

@KC3 

you need to use it in your load script 

Inline ... is an example

you need :

load
"date/time",
if(type='Refund',-1*quantity,quantity) as Net_Qty,
... otherfield

From ...

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
KC3
Creator
Creator
Author

tried this but i am not getting this 

first i tried that only

SCript

KC3_0-1672392691300.png

 

OUTPUT

KC3_1-1672392730878.png

 

Taoufiq_Zarra

@KC3 can you elaborate

its correct your output

or can you share the expected output ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉