Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Create report comparing todays inventory on hand vs yesterdays inventory on and (by each item)

Posted on by 130

Hello All,

I am having a hard time generating a custom report with the following 3 columns:

  • Item No. (every item no. in our items table)
  • Quantity On Hand As of Today
  • Quantity On Hand As of Yesterday

I am experimenting with calcformulas, flow fields, even analysis template.....and thanks to Zhu for a great tutorial - but I am still stuck. 

Any help would be appreciated

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Create report comparing todays inventory on hand vs yesterdays inventory on and (by each item)

    Just a little tips.

    Instead of creating a new flow field you can use the existing field Net change that is already on the Item table.

     field(70; "Net Change"; Decimal)
            {
                CalcFormula = Sum("Item Ledger Entry".Quantity WHERE("Item No." = FIELD("No."),
                                                                      "Global Dimension 1 Code" = FIELD("Global Dimension 1 Filter"),
                                                                      "Global Dimension 2 Code" = FIELD("Global Dimension 2 Filter"),
                                                                      "Location Code" = FIELD("Location Filter"),
                                                                      "Drop Shipment" = FIELD("Drop Shipment Filter"),
                                                                      "Posting Date" = FIELD("Date Filter"),
                                                                      "Variant Code" = FIELD("Variant Filter"),
                                                                      "Lot No." = FIELD("Lot No. Filter"),
                                                                      "Serial No." = FIELD("Serial No. Filter"),
                                                                      "Unit of Measure Code" = FIELD("Unit of Measure Filter"),
                                                                      "Package No." = FIELD("Package No. Filter")));
                Caption = 'Net Change';
                DecimalPlaces = 0 : 5;
                Editable = false;
                FieldClass = FlowField;
            }

  • SammySevens Profile Picture
    SammySevens 130 on at
    RE: Create report comparing todays inventory on hand vs yesterdays inventory on and (by each item)

    Thanks to this blog post - here is what I have - how does it look?

    • Extended item table 
    • Created 4 fields: YDayDate, YDayQuantity, TDayDate,TDayQuantity
    • Created new page with sourcetable = Item
    • OnOpenPage - set 2 filters for YDayDate, and TDayDate

    tableextension 60002 pExt60002ItemMfrName extends Item
    {
        fields
        {
            field(60000; "Manufacturer Name"; Text[100])
            {
                TableRelation = Manufacturer;
                Caption = 'lookupManufacturer';
                FieldClass = FlowField;
                CalcFormula = lookup(Manufacturer.Name where(Code = field("Manufacturer Code")));
            }
            field(60001; "Vendor Name"; Text[100])
            {
                TableRelation = Vendor;
                Caption = 'lookupVendorName';
                FieldClass = FlowField;
                CalcFormula = lookup(Vendor.Name where("No." = field("Vendor No.")));
            }
            field(60002; "Today Quantity"; Decimal)
            {
                Caption = 'Field';
            }
            field(60003; "yDayDate"; Date)
            {
                Editable = false;
                FieldClass = FlowFilter;
            }
            field(60004; tDayDate; Date)
            {
                Editable = false;
                FieldClass = FlowFilter;
            }
            field(60005; yDayQuantity; Decimal)
            {
                Editable = false;
                FieldClass = FlowField;
                CalcFormula = sum("Item Ledger Entry".Quantity where("Item No." = field("No."), "Posting Date" = field(yDayDate)));
    
            }
            field(60006; tDayQuantity; Decimal)
            {
                Editable = false;
                FieldClass = FlowField;
                CalcFormula = sum("Item Ledger Entry".Quantity where("Item No." = field("No."), "Posting Date" = field(tDayDate)));
            }
        }
    }

    page 60003 p60003DailyInvDelta
    {
        ApplicationArea = All;
        Caption = 'Daily Inventory Delta';
        PageType = List;
        SourceTable = Item;
        UsageCategory = Lists;
    
        layout
        {
            area(content)
            {
                repeater(General)
                {
                    field("No."; Rec."No.")
                    {
                        ToolTip = 'Specifies the number of the item.';
                    }
                    field(yDayQuantity; Rec.yDayQuantity)
                    {
                        ToolTip = 'Specifies the value of the yDayQuantity field.';
                    }
                    field(tDayQuantity; Rec.tDayQuantity)
                    {
                        ToolTip = 'Specifies the value of the tDayQuantity field.';
                    }
                }
            }
        }
        trigger OnOpenPage()
        begin
            Rec.Reset();
            If not Rec.Get() then begin
                Rec.Init();
                Rec.Insert();
            end;
            Rec.SetFilter(yDayDate, '< %1', WorkDate());
            Rec.SetFilter(tDayDate, '<= %1', WorkDate());
    
        end;
    }
    

  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: Create report comparing todays inventory on hand vs yesterdays inventory on and (by each item)

    Hi

    you must use flowfield and Flowfilter

    pastedimage1676106412738v2.png

    e.g. the "Purchases (Qty.)" field of the Item table can be filtered to AL code with a simple setfilter or setrange on the Posting date field which is a flowfilter acting on the calculation of the "Purchases (Qty.)" field

    check my answer if it helped you, thanks


    DAniele

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,104 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans