Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
gsiva1220
Contributor II
Contributor II

Count in Load Script

Hi ,

I would like to count no.of Ecode where Demand Quantity is greater than same Ecode Demand Quantity.

EcodeDemandOutput
1855813501
18558783
185587002
1855804

let me explain above data with the formula.

Demand 1350 is the largest values so the count of Ecode should be 1.

Demand 78 is less than 1350,700 So the count is 3,

Demand 700 is less that 1350 so the count is 2 ,

Finally 0 is less than all the others right so the count is 4.

Please let me know how to achieve this Qlikview, In Excel the formula is =COUNTIFS(B:B,B32,I:I,">"&I32)+1 

I need to formula in Load Script.

Thanks & Regards,

Siva

1 Solution

Accepted Solutions
sunny_talwar

May be this

LOAD Ecode,

     Demand

     If(Ecode  = Previous(Ecode), RangeSum(Peek('Output'), 1), 1) as Output

Resident .....

Order By Ecode, Demand desc;

View solution in original post

3 Replies
shraddha_g
Partner
Partner

Try:

Load Ecode,

Demand,

Autonumber(recno()), Ecode) as Output

From ... Table

Order by Demand Desc;

sunny_talwar

May be this

LOAD Ecode,

     Demand

     If(Ecode  = Previous(Ecode), RangeSum(Peek('Output'), 1), 1) as Output

Resident .....

Order By Ecode, Demand desc;

View solution in original post

gsiva1220
Contributor II
Contributor II
Author

Hi Sunny,

I have got the solution,

   If( [E Code] = Previous([E Code]),

    if ([Demand Qty for Sep] = Previous([Demand Qty for Sep]),

        Peek('Forecast_Rank'),RangeSum(Peek('Forecast_Rank'), 1) + Peek('E_Code_Commulative')), 1)

   as Forecast_Rank,

   If( [E Code] = Previous([E Code]) and [Demand Qty for Sep] = Previous([Demand Qty for Sep]),

       Peek('E_Code_Commulative') + 1 , 0) as E_Code_Commulative

Regards,

Siva