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: 
majid_ghaboli
Contributor II
Contributor II

Total amount in terms of specific variables in the script

Hi

please guide me

I have table similar below :

Ord_NoInv_NoGroupe_CodeBrand_CodeGood_CodeQuantityAmount
AT950111ATOMICAT_9501501000000
AT950111ATOMICAT_95061002130000
AT950122ATOMICAT_95881202500000
NK950113NIKENK_32882003200000
NK950113NIKENK_65281805200000
NK950124NIKENK_14782004100000
SA950111SALAMONSA_32141507400000
SA950111SALAMONSA_65471656500000
SA950212SALAMONSA_36982105600000
SA950224SALAMONSA_2587665800000
SA950224SALAMONSA_9632506900000

I need total breakdown of order number ( Ord_No ) and invoice number ( Inv_No ) ???

In a expression to this form of writing :

sum ( Amount ) / sum ( TOTAL< Ord_No , Inv_No > Amount )

Please advise me what code to write the script as new variable ???

Thank you

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi Majid,

Hope below script meets your requirement

Inv_Table_Temp:

Load Ord_No,

     Inv_No,

     Groupe_Code,

     Brand_Code,

     Good_Code,

     Quantity,

     Amount

From ...;

join (Inv_Table_Temp)

Load Ord_No,

     Inv_No,

     sum(Amount) as Amount_Per_Inv

Resident Inv_Table_Temp

group by Ord_No,Inv_No;

Inv_Table:

Load *, Amount/Amount_Per_Inv as Avg_Amt

Resident Inv_Table_Temp;

Drop Table Inv_Table_Temp;

View solution in original post

3 Replies
vinieme12
Champion III
Champion III

what do you mean by breakdown?

Can you explain a sample output

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
majid_ghaboli
Contributor II
Contributor II
Author

Hi

sorry I mean ... I need the total amount per (Ord_No) and (Inv_No) in script

What solution can you suggest

Anonymous
Not applicable

Hi Majid,

Hope below script meets your requirement

Inv_Table_Temp:

Load Ord_No,

     Inv_No,

     Groupe_Code,

     Brand_Code,

     Good_Code,

     Quantity,

     Amount

From ...;

join (Inv_Table_Temp)

Load Ord_No,

     Inv_No,

     sum(Amount) as Amount_Per_Inv

Resident Inv_Table_Temp

group by Ord_No,Inv_No;

Inv_Table:

Load *, Amount/Amount_Per_Inv as Avg_Amt

Resident Inv_Table_Temp;

Drop Table Inv_Table_Temp;