Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Calculating overdue days

Hello Everyone,

 

I have 3 tables, i have to calculate overdues days

 

Customer Ledger Entry table

 

 

Customer CodeInvoice DateInvoice NoDue Date
TRD0075504/01/2015IN00000104/01/2015
TRD0075504/01/2015CR00000104/01/2015
TRD0079104/01/2015IN00000204/01/2015
TRD0079104/01/2015CR00000204/01/2015
TRD0134904/01/2015IN00000304/01/2015
TRD0056404/01/2015IN00000404/01/2015
TRD0069004/01/2015IN00000504/01/2015
TRD0069004/01/2015CR00000304/01/2015
TRD0137904/01/2015IN00000604/04/2015
TRD0137904/01/2015CR00000404/01/2015
TRD0116704/01/2015IN00000704/01/2015
TRD0094204/01/2015IN00000804/01/2015
TRD0094204/01/2015CR00000504/01/2015

 

Detailed Cust Ledger Entry

 

 

Posting DateInvoice NoAmountCustomer Code
01/01/1753 0 
04/01/2015IN000001498.5TRD00755
04/01/2015CR000001-80.5TRD00755
04/01/2015CR000001-80.5TRD00755
04/01/2015CR00000180.5TRD00755
04/01/2015IN0000022313.46TRD00791

 

Customer table

 

 

Customer CodeCustomer Name
TRD00250Indian Association Umm Al Quwain (IAU)
TRD00251Pharmatrade(Abu Dhabi)
TRD00252United Medical Supplies (UNIMED)L.L.C
TRD00253Ambassador Pharmacy
TRD00261Al Ahliya Pharmacy

 

Expected Result Format

 

 

How do i calculate overdues days..

 

Kindly Help

1 Reply

  • Hi Anonymous ,

     

    You need to create a date table and then make the following:

    • Relationships:
      • DimDate -> CustomerLedgerEntry
      • Customer -> Customer Ledger Entry
      • CustomerLedger Entry -> Detailed Cust Ledger
    • Date slicer (based on dimDate table)
    • Customer slicer based on customer table)
    • Now create the following measure:
    Overdue Days =
    IF (
        SUM ( 'Detailed Cust Ledger Entry'[Amount] ) = BLANK ();
        BLANK ();
        DATEDIFF ( SELECTEDVALUE ( 'Customer Ledger Entry'[Due Date] ); TODAY (); DAY )
    )

    Check PBIX file attach, please be aware that this file has a relationship between the invoice date an the dimdate so the slicer works looking for the invoice date if you want to slice accordingly to the due date you need to make the relationship with Due date column.