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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Carlaf_93
Creator II
Creator II

SCRIPT

Good morning,

i've got a table like:

TABLE1:

CODE,

VALUE,

TYPE;

in this table i have a code (90000) that's zero.

I would like to give a value like:

if(code='90000' , sum({<TYPE='E'>}VALUE), sum(VALUE)) as VALUE;

 

How can i do it?

12 Replies
Taoufiq_Zarra
MVP
MVP

it's because I didn't understand the request.

Maye be this its OK :

TABLE1:

LOAD * INLINE [
    CODE, VALUE, TYPE,YEAR
    1, 10, A,2020
    2, 20, E,2020
    3, 30, E,2019
    4, 40, A,2019
    90000, 0, P,2020
    90000, 0, P,2019
];
left join 
load YEAR,sum(VALUE) as SUM90000 resident TABLE1  where TYPE='E' group by YEAR;

OUTPUT:
noconcatenate

load CODE, if(CODE='90000',SUM90000,VALUE) as VALUE, TYPE,YEAR resident TABLE1;

drop table TABLE1;

 

output:

Taoufiq_Zarra_0-1612176427863.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Carlaf_93
Creator II
Creator II
Author

Thank you! Now it works 🙂

Sorry for my bad explanation

Ksrinivasan
Specialist
Specialist

hi,

Calaf_93,

Mr. Taoufiqu Zarra is right, as per your requirement he gave solution.

even though now you can try Coordinate (Year & Code), then it will give result to you.

 

ksrinivasan.