Forum Discussion

eric98's avatar
eric98
Icon for Helper II rankHelper II
4 years ago
Solved

Find two different last date in the same column

Hello everyone.

I'm facing an issue and you may help me with that.

As you will see in the table below, I have four columns : invoice_number, invoice_date, customer_number, customer_machine_number.

The customer_machine number is a nullable column.

I notice that when I make a search the last date of the column invoice_date in this table, if the customer_number is not null and the customer_machine_number is null, I find one last date.

But if the customer_number and the customer_machine_number are both not null, I find another last date.

I would like to show the two different last date in a matrice table but I don't know how to do it.

Anyone ?

 

invoice_numbercustomer_numbercustomer_machine_numberinvoice_date
78768751234561236781/1/2021
7786875123456 1/1/2021
70968751234561236781/1/2021
7456875123456 1/1/2021
7026875123456 1/1/2021
79468751234561236782/1/2021
7086875123456 1/1/2021
78791051234561236782/1/2021
7870375123456 1/1/2021
7870R15123456 1/1/2021
78015Z51234561236782/1/2021

 

invoice_numbercustomer_numbercustomer_machine_numberlast_date(invoice_date)
78015Q51234561236782/1/2021

 

invoice_numbercustomer_numbercustomer_machine_numberlast_date(invoice_date)
78015Q5123456 1/1/2021

 

 

 

  • I finally solve the problem with this measure : 

    Date1 = CALCULATE( MAX([INVOICE_DATE]), FILTER(INVOICE_TABLE, AND(CUSTOMER_NUMBER <> BLANK(), MACHINE_NUMBER <> BLANK())))
    And for the second date, just do Date2 = MAX(INVOICE_DATE)

5 Replies

  • measure 1 =  // where machine and customer number not null

    CALCULATE(MIN(Table[Invoice Date]),AND('Table'[Customer_Number] <> BLANK(),'Table'[Machine_Number] <> BLANK())
    measure 2 = MIN(Table[Invoice Date])
    • eric98's avatar
      eric98
      Icon for Helper II rankHelper II

      Hello !

      Thank for your help, but this measures doesn't work...

      I found the good date for the measure 2 but not for the measure 1

      • mh2587's avatar
        mh2587
        Icon for Super User rankSuper User

        try max in place MIN hope this will give you the output 

  • I finally solve the problem with this measure : 

    Date1 = CALCULATE( MAX([INVOICE_DATE]), FILTER(INVOICE_TABLE, AND(CUSTOMER_NUMBER <> BLANK(), MACHINE_NUMBER <> BLANK())))
    And for the second date, just do Date2 = MAX(INVOICE_DATE)