web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Multiple filters for same dataitem

(0) ShareShare
ReportReport
Posted on by 358

 am making a report to sum the total of AmountIncVAT value from the Sales Invoice Table.

In the Sales Invoice Table, I want to Sum for entries related to 'Customer1' and 'Customer2'.
So the Sum of all the entries of Customer1 and Customer2 will be printed on the report.

I successfully did for Customer1 by the following method. (It might be the wrong approach to start with hence I am here seeking help)
OnPreDataItem of my report I wrote

"Sales Invoice Line".SETFILTER("Sell-to Customer No.",'Customer1');
"Sales Invoice Line".FINDSET;

Note my dataitem of the report just has Sales Invoice Line and a couple of its fields including the AmountIncVAT

In the Layout, I add a table, add AmountIncVAT, beneath Sum it and hide the row where the rows will be printed and let the Sum row visible. All good.

How do I know put another filter to filter "Sales Invoice Line".SETFILTER("Sell-to Customer No.",'Customer2'); and have another table with the same Sum of Customer2 in it?

  • Suggested answer
    Olister Rumao Profile Picture
    4,009 on at

    Hi MySamza,

    You can do this.

    Add filter as

    "Sales Invoice Line".SETFILTER("Sell-to Customer No.",'%1|%2','Customer1','Customer2');

  • Suggested answer
    Avinash B Profile Picture
    1,455 on at

    Hi,

    Use Customer table has DataItem and on the trigger "OnAfterGetRecord" use Sales Invoice Line variable to get the sum for the customer.

    The below lines of codes might work.

    SalesInvoiceLine.SETCURRENTKEY("Sell-to Customer No.");

    SalesInvoiceLine.SETRANGE("Sell-to Customer No.","No.");

    SalesInvoiceLine.CALCSUMS("Amount Including VAT");

    This will show data related to all the customer.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans