Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
kirankumarsonoco
Contributor II
Contributor II

Running Total Calculation in Script Level

Hi Team,

I need to calculate the running total in script level, combination of Plant code and Item code, Please suggest to me ASAP,  We have script like this,

Data:

LOAD
PLANT_CODE,
ITEM_CODE,
Key1,
DUE_DATE,
ITEM_DESCRIPTION,
ITEM_TYPE,
"Item Code Description",
"VENDOR_NUM" ,
"VENDOR_NAME",
"PO_NUMBER",
UOM,
COST,
day_key,
sum(ON_QTY) as ON_QTY,
DIM_TIME.REAL_DATE,
sum(EPO_QTY) as EPO_QTY,
sum(USAGE_QTY) as USAGE_QTY,
sum(Demand_QTY) as Demand_QTY
FROM [lib://DM_IPD_QVDs/Fact/Resin_Final_Master_Table.qvd]
(qvd)

group By
PLANT_CODE,
ITEM_CODE,
Key1,
DUE_DATE,
ITEM_DESCRIPTION,
ITEM_TYPE,
"Item Code Descriptio",
UOM,
COST,
day_key,
DIM_TIME.REAL_DATE,"VENDOR_NUM" ,
"VENDOR_NAME",
"PO_NUMBER";

Labels (1)
7 Replies
vikasmahajan

Data:

LOAD
PLANT_CODE,
ITEM_CODE,
Key1,
DUE_DATE,
ITEM_DESCRIPTION,
ITEM_TYPE,
"Item Code Description",
"VENDOR_NUM" ,
"VENDOR_NAME",
"PO_NUMBER",
UOM,
COST,
day_key,
sum(ON_QTY) as ON_QTY,
DIM_TIME.REAL_DATE,
sum(EPO_QTY) as EPO_QTY,
sum(USAGE_QTY) as USAGE_QTY,
sum(Demand_QTY) as Demand_QTY
FROM [lib://DM_IPD_QVDs/Fact/Resin_Final_Master_Table.qvd]
(qvd)

group By
PLANT_CODE,
ITEM_CODE;

Take Straight table & display fields dim : Plant_Code & Iteam Code 

in expression sum(EPO_QTY)  etc...

 

Hope this helps

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.
kirankumarsonoco
Contributor II
Contributor II
Author

Hi Vikas,

i need to achieve the running total in script level based on plant Code and Item Code

vikasmahajan

Then join with this code

Right Join(Data)

LOAD

PLANT_CODE,
ITEM_CODE,

sum(EPO_QTY) as EPO_QTY,
sum(USAGE_QTY) as USAGE_QTY,
sum(Demand_QTY) as Demand_QTY

Resident Data  Group By PLANT_CODE,ITEM_CODE   Order By PLANT_CODE,ITEM_CODE ;

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.
kirankumarsonoco
Contributor II
Contributor II
Author

but i need to calculate the running sum value in script level, you have, can we connect some time

kirankumarsonoco
Contributor II
Contributor II
Author

Please anyone suggest still this issue is not completed, i need to calculate the running total in script level based on Plant and Item code

vikasmahajan

Sorry for late reply 

Data:
LOAD * Inline [
Date,Plant, Item, Factor, Value
March,P1, NAM, 1, 50
March,P1, NAM, 3, 25
March,P1, NAM, 12, 10
March,P2, AFI, 5, 200
March,P2, AFI, 9, 100
March,P2, AFI, 1, 75
April,P3, NAM, 10, 500
April,P3, NAM, 11, 250
April,P3, NAM, 3, 150
April,P4, AFI, 8, 90
April,P4, AFI, 3, 30
April,P4, AFI, 1, 10
];

**bleep**:
NoConcatenate
LOAD Date,Plant,Item,Value,
if(Previous(Date)=Date and Previous(Item)=Item and Previous(Plant)=Plant , RangeSum(Value,Peek('Cummulative Sales')),Value) as [Cummulative Sales]
Resident Data
Order by Date,Plant,Item;

drop Table Data;

you can create script like this.

 

Vikas

 

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.
kirankumarsonoco
Contributor II
Contributor II
Author

I have tried  above script but still cumulative values are not coming, see below screenshot

 

kirankumarsonoco_0-1642414038757.png