Forum Discussion

fdsilva's avatar
fdsilva
Frequent Visitor
7 years ago
Solved

Filter data by date selecting a label

Hi folks!   I have a data table with information like ResourceName, ResourceType, Cost, ConsumptionDate, and others. Let's call it Table01. Now, I created an invoice table, with the columns: Invoi...
  • MFelix's avatar
    MFelix
    7 years ago

    Hi fdsilva ,

     

    Try the following code:

    Filter Invoice =
    VAR MinimumDate =
        MAX ( Invoices[StartDate] )
    VAR maximumdate =
        MAX ( Invoices[EndDate] )
    RETURN
        IF (
            COUNT ( Invoices[InvoiceNr] )
                = CALCULATE ( COUNT ( Invoices[InvoiceNr] ); ALL ( Invoices[InvoiceNr] ) );
            1;
            IF (
                COUNTROWS ( ALLSELECTED ( Invoices ) ) < 1;
                BLANK ();
                IF (
                    MAX ( Resources[ConsuptionDate] ) <= maximumdate
                        && MAX ( Resources[ConsuptionDate] ) >= MinimumDate;
                    1;
                    BLANK ()
                )
            )
        )

    Regards,

    MFelix