SUM(Quantity) Report

Hey Everyone,

So I’m trying to create a report that sums the quantity of a product we sell. Currently I’m using a flowfield located in the customer table that looks like this:

 Sum("Sales Invoice Line".Quantity WHERE (Sell-to Customer No.=FIELD(No.),No.=FILTER(A|B|C))) 

However, I need to filter by SalesInvoiceLine.“Document No.” so that it only counts the quantity when the Doc# is unique. I’m almost positive this isn’t the best way to go about it, so any suggestions are appreciated.

So essentially I want to count the number of unique Sales Invoice Headers a customer has but only if the Sales Invoice Line.“No.” = A|B|C. My questions to you all are:

a) Should I be hardcoding this all into the report, instead of using flowfields in the customer table? (If so, I’ll show you what I have coded in c/al so far)

b) Would it make more sense to use a count(sales header) and then filter on the sales somewhere in the report?

Thanks for your help! Any and all suggestions are welcome.

Hi Dan,

Thanks for Question. I to have same requirement. Have you found any solution. If yes, Can you please share.

Thanks in Advance

No you don’t need hardcode it,

simply using Mark functions inside C/AL, learn how to use it and you’ll get everything easily done.