Announcements
This seems like a bog standard report and I can't believe its not available...or am I missing something? I'm looking for essentially the Customer Sales Statistics report, but I need 12 months broken out, not 4.
I've tried doing a sales analysis report but can't seem to get the formula for the dates to work and I can't choose a date range when I run the matrix. I've tried customizing the reports but I'm still learning AL and am struggling a little there. Am I missing an easy way to get this standard report? I can setup an Excel layout, but I don't see how to get the right data for it, I think I would need the sales ledger, but I can't export that to build a template.
I'm obviously just in the dark on the right way forward. Appreciate any help.
I would add a calendar table like this: www.sqlbi.com/.../
The item table too because filters should derive from there and not the ILE’s. You may have dimension filter requirements too so add those if necessary.
I believe the report you’re trying to replicate uses the customer ledger entries. If you want an item sales focused spin on things you’re going in the right direction. Value entries hold the value invoices though. ILE’s do have a flowfield to the info and of course display better detail.
This is very informative, appreciate it. Im working through the AL just to learn, but I keep running into the suggestion to get PowerBI up and running so Im running through the trial now.
Do you happen to know offhand what tables I'd need to grab to recreate the Customer Sales Statistics report? I started with the Customer table and Item ledger but I think Im missing some needed data.
Totally agree with Josh, go Power BI if you have the chance to do so.
I’d produce a new report. Power BI would be the best place to do it. If you don’t have access then maybe AL is ok. A general approach to try with AL:
Main dataitem to be the customer
Var
DateHdr: array[12] of Text;
Amt: array[12] of decimal;
Dataset wise have a column for all 12 months:
column(DateHdr1; DateHdr[1]) { }
column(DateHdr2; DateHdr[2]) { }
column(DateHdr3; DateHdr[3]) { }
column(DateHdr4; DateHdr[4]) { }
column(DateHdr5; DateHdr[5]) { }
column(DateHdr6; DateHdr[6]) { }
column(DateHdr7; DateHdr[7]) { }
column(DateHdr8; DateHdr[8]) { }
column(DateHdr9; DateHdr[9]) { }
column(DateHdr10; DateHdr[10]) { }
column(DateHdr11; DateHdr[11]) { }
column(DateHdr12; DateHdr[12]) { }
column(Amt1; Amt[1]) { }
column(Amt2; Amt[2]) { }
column(Amt3; Amt[3]) { }
column(Amt4; Amt[4]) { }
column(Amt5; Amt[5]) { }
column(Amt6; Amt[6]) { }
column(Amt7; Amt[7]) { }
column(Amt8; Amt[8]) { }
column(Amt9; Amt[9]) { }
column(Amt10; Amt[10]) { }
column(Amt11; Amt[11]) { }
column(Amt12; Amt[12]) { }
Trigger wise:
trigger OnPreDataItem()
var
CurrDate: Date;
i: Integer;
Month: Integer;
Year: Integer;
begin
CurrDate := GetRangeMin("Start Date");
for i := 1 to ArrayLen(DateHdr) do begin
MnthArr[i] := Date2DMY(CurrDate, 2);
YearArr[i] := Date2DMY(CurrDate, 3);
DateHdr[i] := StrSubstNo('%1/%2', Date2DMY(CurrDate, 2), Date2DMY(CurrDate, 3));
CurrDate := CalcDate('<1M>', CurrDate);
end;
end;
OnAfterGetRecord have a procedure called to calculate the values.
for i := 1 to ArrayLen(DateHdr) do begin
CalcPeriodDate(i, StartDate, EndDate);
Amt[i] := whatever you need it to be
André Arnaud de Cal...
294,125
Super User 2025 Season 1
Martin Dráb
232,871
Most Valuable Professional
nmaenpaa
101,158
Moderator