Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sarath123
Contributor III
Contributor III

How to write a script to define sales for each quarter

I have the data as attached below.

Lastime I calculated the sales based on the code by taking the sum of sales for the particular code

Now I am trying to caculate the sales for each quarter by using my caculated codes to find them
for code 3101 the sales should be sum of sales(3101)-sales(31010140)-sales(31010160)-sales(31010107)

for code 3201 the sales should be sum of sales (3201)-sales(32010140)-sales(32010160)-sales(32010107)

suppose for quarter Q2 2019 sales for both 3101&3201 should be exchanged with the caculated sales by using the above condition. I don't need the sum of sales instead for each quarter I need the sales value.
Like this I need to change my data for all the quarters (9quarters)with the new calculated values so that I can sum the sales values later
Can someone help me to define that on the script
My final output should be as
code      TU_company_QTR          TU_Total_QTR                     quarter                year 
3101              xxxxxx                                xxxxxx                                    Q2                       2019
3101              xxxxxx                                xxxxxx                                    Q1                        2019
.
.

3101              xxxxxx                              xxxxxxx                                   Q2                          2017
where   xxxx will be the new calculated sales by using  below  condition 
3101 should be sum of sales(3101)-sales(31010140)-sales(31010160)-sales(31010107)


Can someone help me to define that on the script

1 Solution

Accepted Solutions
Brett_Bleess
Former Employee
Former Employee

Sarath, try searching in the Design Blog area using the following link, I suspect you will find some useful examples on how to do things that should assist you in figuring things out.

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.

View solution in original post

1 Reply
Brett_Bleess
Former Employee
Former Employee

Sarath, try searching in the Design Blog area using the following link, I suspect you will find some useful examples on how to do things that should assist you in figuring things out.

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.