Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Absolute Sum while loading the script

Hi, I would like to know if there is any function that let sum the absolute values while the script is loading. Something like this:

MapValuedQuantity:

MAPPING LOAD

[Document No_], [Valued Quantity];

SQL SELECT     [Document No_], Sum(ABSOLUTE([Valued Quantity])) AS [Valued Quantity]

FROM         "$(_DBName)"."$(_DBOwner)"."$(_CompanyName)$Value Entry"

GROUP BY [Document No_];

I've tried the fabs() but it doesn't work here.

Good weekend to you all.

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this script

Temp:
[Document No_],

[Valued Quantity],

1 AS Temp;

SQL SELECT     [Document No_], [Valued Quantity] AS [Valued Quantity]
FROM         "$(_DBName)"."$(_DBOwner)"."$(_CompanyName)$Value Entry";

MAPPING LOAD

LOAD
[Document No_],

Sum(fabs([Valued Quantity])) AS [Valued Quantity]

RESIDENT Temp

GROUP BY [Document No_];

DROP TABLE Temp;

Regards,

jagan.

View solution in original post

5 Replies
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi You can use workaround as

Sum(If(Quantity<0,Quanitity*-1,Quantity)) as AbsQuantity

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     In qlikView use Sum(Fabs([ValueQuantity]))

Celambarasan

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

TableName:

LOAD

    F1,

    Fabs(F2) AS F2;

LOAD * INLINE [

    F1, F2

    a, -1

    b, 2

    c , -3

];

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this script

Temp:
[Document No_],

[Valued Quantity],

1 AS Temp;

SQL SELECT     [Document No_], [Valued Quantity] AS [Valued Quantity]
FROM         "$(_DBName)"."$(_DBOwner)"."$(_CompanyName)$Value Entry";

MAPPING LOAD

LOAD
[Document No_],

Sum(fabs([Valued Quantity])) AS [Valued Quantity]

RESIDENT Temp

GROUP BY [Document No_];

DROP TABLE Temp;

Regards,

jagan.

Not applicable
Author

Hi thanks you three for your time. I've tried the three methods and the jagan's one was the only that worked.

Nice day.