Forum Discussion

vytas's avatar
vytas
Helper I
6 years ago
Solved

Min/Max Dates

Hi,  I have virtual table : Unpaid Invoices = FILTER (     ADDCOLUMNS (         SUMMARIZE (             Debt;             Debt[DocumentNr];             Debt[CompanyNo];             Debt[Paym...
  • Mariusz's avatar
    6 years ago

    Hi vytas 

     

    Try something like this.

    Measure = 
    VAR __tbl =
        FILTER (
            ADDCOLUMNS (
                SUMMARIZE (
                    Debt;
                    Debt[DocumentNr];
                    Debt[CompanyNo];
                    Debt[PaymentDay]
                );
                "Saldo"; CALCULATE ( SUM ( Debt[Debt] ) );
                "InvoiceDate"; CALCULATE ( MAX ( Debt[InvoiceDate] ) )
            );
            [Saldo] > 0
        )
    VAR __min = MINX( __tbl, [InvoiceDate] )
    VAR __max = MAXX( __tbl, [InvoiceDate] )
    RETURN 
        __max - __min 

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn