Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
amita1621
Contributor III
Contributor III

Subtraction

Hi All,

I have a query in qlikview , i have attached a image file where in i have 2 columns flag and amount, i need to subtract Gross-RI in qlikview in table , how to use that.

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Sum({<Flag={'Gros'}>} Amount) - Sum({<Flag={'RI'}>} Amount)


-Rob

maxgro
MVP
MVP

maybe this expression

if(Dimensionality()=0, sum({$ <Flag*={Gross}>} Amount) - sum({$ <Flag*={RI}>} Amount), sum(Amount))

1.png

maxgro
MVP
MVP

S:

load *, rowno() as id inline [

Flag, Amount

Gross,34

Gross,21

Gross,21

RI,12

RI,34

RI,23

];

Link:

LOAD

    id,

    Flag as NewFlag,

    1 as PM

Resident S;

Concatenate(Link) LOAD

    id,

    'Net' as NewFlag,

    if(Flag = 'Gross', 1, -1) as PM

Resident S;



Dimension    NewFlag

Expression    sum(Amount * PM)

1.png

amita1621
Contributor III
Contributor III
Author

Thanks