Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ngrunoz
Contributor II
Contributor II

Running Totals

I have the data attaché herewith. I am using Qlikview 11.

I would want to create a table with running totals on the sales and the Projected sales to Look Like the table below. I would like the running total to be by each miner and to only accumulate within each financial Year

   

FYMovement DateMiner DetailsMiner nameOpening balanve As At Opening FYQuanty SoldQuanty ProjectedRunning Total Quantity SoldRunning Total Quantity ProjectedStock On Hand
201618/04/2016AZ111111ax500100120100120400
201619/04/2016AZ111112ava400200150200150200
201620/04/2016AZ111113affa20015016015016050
201621/04/2016AZ111114axsd30020202020280
201622/04/2016AZ111115asdsd40020152015380
201618/04/2016AZ111111ax5005040150160350
201619/04/2016AZ111112ava4001207032022080
201620/04/2016AZ111113affa20012090270250-70
201621/04/2016AZ111114axsd300140100160120140
201622/04/2016AZ111115asdsd40070509065310
201719/04/2017AZ111112ava70030253025670
201720/04/2017AZ111113affa50020202020480
201721/04/2017AZ111114axsd30025202520275
201722/04/2017AZ111115asdsd15050705070100
201726/04/2017BZ000052asdsd17030153015140
201727/04/2017BZ000053scs20017501750183
201728/04/2017BZ000054cxdf30021302130279
201719/04/2017AZ111112ava70060308550615
201720/04/2017AZ111113affa50015206590435
201721/04/2017AZ111114axsd30048757890222
201722/04/2017AZ111115asdsd15056807313077
201726/04/2017BZ000052asdsd170781009913071
201727/04/2017BZ000053scs200120150205200-5
201728/04/2017BZ000054cxdf300130140195230105
1 Solution

Accepted Solutions
Anonymous
Not applicable

script solution:

TEMP2: LOAD [Miner Details], [Miner name], FY, [Movement Date], Branch, Product, Quanty, Price, Name
FROM [String 2.xlsx] (ooxml, embedded labels, table is [Buying Sheet]);

NoConcatenate

TEMP:
LOAD RowNo() as #,* Resident TEMP2 Order by FY,[Miner name];

DROP Table TEMP2;

NoConcatenate

FINAL:
LOAD
*,
if(Previous(([Miner name]))<>[Miner name] or (Previous([FY])<>[FY]),Quanty,rangesum(Peek('Quantity_ac'),Quanty))  as Quantity_ac
Resident TEMP;

DROP Table TEMP;

View solution in original post

9 Replies
sunny_talwar

Are you looking to do this in the script or front end of the application?

devarasu07
Master II
Master II

Hi,

try like this,

ABC Analysis in Qlikview

Anonymous
Not applicable

you could use recursive rangesum():

if(FY=Above(total FY),
rangesum(above(total expression),sum(Quanty)),
sum(Quanty)
)

ngrunoz
Contributor II
Contributor II
Author

I would Prefer to do it in the script. but I will be glad to know how to do it in the front end too.

ngrunoz
Contributor II
Contributor II
Author

I have failed to Copy.  But what I am trying to achieve is have the running total based on 2 dimension First being the (MovementDate and FY) and the second being the Miner details.

That is to say the Quantity Sold  will only have to accumulate in the same FY and for the same Miner and not add for different miners in the same year.

Anonymous
Not applicable

front end solution:


if(FY=Above(total FY) and [Miner name]=Above(TOTAL [Miner name]),
rangesum(above(total expression),sum(Quanty)),
sum(Quanty)
)

Anonymous
Not applicable

script solution:

TEMP2: LOAD [Miner Details], [Miner name], FY, [Movement Date], Branch, Product, Quanty, Price, Name
FROM [String 2.xlsx] (ooxml, embedded labels, table is [Buying Sheet]);

NoConcatenate

TEMP:
LOAD RowNo() as #,* Resident TEMP2 Order by FY,[Miner name];

DROP Table TEMP2;

NoConcatenate

FINAL:
LOAD
*,
if(Previous(([Miner name]))<>[Miner name] or (Previous([FY])<>[FY]),Quanty,rangesum(Peek('Quantity_ac'),Quanty))  as Quantity_ac
Resident TEMP;

DROP Table TEMP;

ngrunoz
Contributor II
Contributor II
Author

Hi Robin

I have encountered another challenge on the script version. when they is a record in between with a zero the script seems to be subtracting the previous value. how can I over come this?

Thanks

ngrunoz
Contributor II
Contributor II
Author

Sorry my bad. I have picked my error.