Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nickjose7
Creator
Creator

How to remove Totals and other unwanted rows using Script?

pradosh_thakurits.anandrjs

Hi,

I have the attached file/table to load.

Have to calculate model wise Sum(Cost)/Sum(Qty) as Exp.


Also need to ensure that:

1. The totals are removed (highlighted in Red & Blue)

2. If a model is repeated, then the average of repeated rows has to be considered:


e.g in case of FTP-005  the Exp. would be 18333.34 i.e (100000/15) + (60000/2)) / 2



Looking forward to your help,

Nick

3 Replies
its_anandrjs

Load your table this way to not consider the rows where you have Total on that row and make clean on the load script and then do calculation for Exp that you have and take to table itself.

Data:

LOAD RowNo() as RowID,

     FieldA,

     [Field Center],

     Model,

     Quantity,

     Cost

FROM

[Value by Sheet Aug17 - CSD.xlsx]

(ooxml, embedded labels, table is Sheet1)

Where right([Field Center],5) <> 'Total' and Right(FieldA,5) <> 'Total';

Left Join

LOAD

Model,RowID,

Sum(Cost)/Sum(Quantity) as Exp

Resident Data Group By Model,RowID;


OP03.PNG

nickjose7
Creator
Creator
Author

Hi Anand,

If a model is repeated, then the average of repeated rows has to be considered:


e.g in case of FTP-005  the Exp. would be 18333.34 i.e (100000/15) + (60000/2)) / 2

pradosh_thakur
Master II
Master II

Hi nick

Please find the attached. Named after you.

regards

Pradosh

Learning never stops.