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: 
Not applicable

How to subtract rows in Straight or Piovt table

Input FileDesired   Qlikview Output
Dim1AmountDim1Amount
A10A10
B20B20
C40C40
E60E60
F80F60F=80-20
G90G-50G=40-90

Untitled.png

Hi i have input file like Dim 1 and Amount are fileds

now i want Subtract Two particular rows like F=F-B(-50) and G= C-G (60)

please help thanks

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Use expression like:

If( Dim1='G', Sum(total {<Dim1={'C'}>}Amount)-Sum(total {<Dim1={'G'}>}Amount),

  If( Dim1='F', Sum( total {<Dim1={'F'}>}Amount)-Sum(total {<Dim1={'B'}>}Amount), Sum(Amount))

  )

Capture.JPG

View solution in original post

5 Replies
tresesco
MVP
MVP

Doing it in the script would a better solution I believe. Have a look here:

How to Create a Profit and Loss Statement in QlikView

How IntervalMatch Solved My Profit and Loss Dilemma

Not applicable
Author

the above is straight foreword it wont help

tresesco
MVP
MVP

Well, I don't really understand which one is so-simple and why that could not help. Could you let me know if a script solution would help you or you want it in the UI?

Not applicable
Author

i want it in ui only

tresesco
MVP
MVP

Use expression like:

If( Dim1='G', Sum(total {<Dim1={'C'}>}Amount)-Sum(total {<Dim1={'G'}>}Amount),

  If( Dim1='F', Sum( total {<Dim1={'F'}>}Amount)-Sum(total {<Dim1={'B'}>}Amount), Sum(Amount))

  )

Capture.JPG