Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Could you help me to adapt the code to get the grand total of the column Quantity?
My table looks like:
Index | Item | Quantity |
53535 | X | -45 |
65456 | Y | -486 |
43554 | Z | -765 |
The Code I have is below. I had to myltiply the values by -1 to get the real sale.
Newone:
LOAD [Index],
[Item],
if("[Quantity]">0, "[Quantity]"*-1, "[Quantity]"*-1)
Resident sale;
Drop Table sale;
Thanks in advance.
For script you can do this
Newone:
LOAD [Index],
[Item],
if("[Quantity]">0, "[Quantity]"*-1, "[Quantity]"*-1) as Quantity
Resident sale;
Drop Table sale;
Concatenate (Newone)
LOAD Sum(Qunatity) as Quantity
Resident Newone;
Get the grant total in the script?
yes, in script
What would the Index and Item value be for the total row?
What I need to obtain is:
Index | Item | Quantity |
53535 | X | 45 |
65456 | Y | 486 |
43554 | Z | 765 |
1 296 |
I am new to Qlik Sense and not sure whether it is possible to obtain.
Regards
This is possible, but is not best practice. This is something you can very easily do it on the front end, is there a reason you want this to be done in the script?
I need it for the report to get the total sale, because I need to show the sale per product and the total sale por particular period of time.
What solution can you propose?
For script you can do this
Newone:
LOAD [Index],
[Item],
if("[Quantity]">0, "[Quantity]"*-1, "[Quantity]"*-1) as Quantity
Resident sale;
Drop Table sale;
Concatenate (Newone)
LOAD Sum(Qunatity) as Quantity
Resident Newone;
Thank you very much, it works!
I have worked on it since morning!