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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist
Specialist

script

Hi Expert,

 

Need quick help:

I have table with below fields :

 

Division FlagValue
ALPHAA1000
ALPHAB100
BETAA2000
BETAB200
GAMMAA3000
GAMMAB300

 

I want one resulting column which should be calculated as "A-B"

DivisionResultingValue
ALPHA900
BETA1800
GAMMA2700

 

Kindly help.

3 Replies
tresesco
MVP
MVP

One quick solution could be like:

Load
Division,
Sum(If(Flag='A', Value,0)-If(Flag='B', Value,0)) as ResultingValue
Group By Division;
Load * Inline [
Division Flag Value
ALPHA A 1000
ALPHA B 100
BETA A 2000
BETA B 200
GAMMA A 3000
GAMMA B 300] (delimiter is spaces);

tresesco_0-1628141659188.png

 

MayilVahanan

Hi

Try like below

Load *, If(Flag='B', -Value, Value) as RV Inline [
Division Flag Value
ALPHA A 1000
ALPHA B 100
BETA A 2000
BETA B 200
GAMMA A 3000
GAMMA B 300] (delimiter is spaces);

In Front end,

MayilVahanan_0-1628144210900.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Mahamed_Qlik
Specialist
Specialist
Author

Thanks for response but Division is not only one dimensions, I have given example here
I have list of dimensions too