Create an Annual Sales Bar & Pie Chart Report – NAV | D365 BC – C/AL

Create an Annual Sales Bar & Pie Chart Report NAV D365 BC CAL | Download the report objects.

This tutorial shows how to create an annual sales bar chart and pie chart report on Microsoft Dynamics 365 Business Central C/AL version or Dynamics Navision RTC version using C/AL programming and SSRS (RDL Report). Watch the below video about how to make the report step-by-step.

In this report, the user can input the year that wants to analyze, and the report shows the charts (bar and pie) of monthly net sales (Posted invoices – Posted credit memos) in the year. So you can download the report objects (.txt or .fob) below.

The C/AL code structure of the backend of the report




<strong>MonthLoop - OnPreDataItem()</strong>

<strong>MonthLoop - OnAfterGetRecord()</strong>
MonthText:=FORMAT(StartDate,3,'<Month Text>');

<strong>MonthLoop - OnPostDataItem()</strong>

<strong>LOCAL GetNetSale</strong>(StartDate : Date;EndDate : Date) NetSale : Decimal
CustLedgerEntry.SETCURRENTKEY("Document Type","Posting Date");
CustLedgerEntry.SETFILTER("Document Type",'%1|%2',CustLedgerEntry."Document Type"::Invoice,CustLedgerEntry."Document Type"::"Credit Memo");
CustLedgerEntry.SETRANGE("Posting Date",StartDate,EndDate);
    CustLedgerEntry.CALCFIELDS("Amount (LCY)");
    NetSale+=CustLedgerEntry."Amount (LCY)";
  UNTIL CustLedgerEntry.NEXT=0;Code language: HTML, XML (xml)

Visit the previous tutorial about, how to create Self-Signed Certificate using Windows PowerShell ISE.

Senior Solutions Architect - Microsoft Dynamics Navision / Microsoft Dynamics 365 Business Central and freelance developer. (The admin of NAVUSER)

Leave a Comment