Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Philipp_ISARTAX
Frequent Visitor

Max Date filtered by a specific criteria/ID

Hello all,

I'va a problem receiving a result for a date. Here is the table-strucutre:

 

Table Name 'Invoices':

Invoice-DateProductPurchase Order (PO)Latest Invoice-Date for PO
01.12.2023XA 
05.12.2023XB 
06.01.2024YA 
08.05.2022ZC 
01.12.2023XB 
08.09.2023ZA 

 

My DAX-Try for the Column Latest Invoice Date for PO was as follows:

Latest Invoice-Date for PO = CALCULATE(Max('Invoices' [Invoice-Date]);Filter('Invoices';'Invoices'[Purchase Order (PO)]='Invoices'[Purchase Order (PO)]))

 

The Dax provides the following Values:

 

Invoice-DateProductPurchase Order (PO)Latest Invoice-Date for PO
01.12.2023XA06.01.2024
05.12.2023XB06.01.2024
06.01.2024YA06.01.2024
08.05.2022ZC06.01.2024
01.12.2023XB06.01.2024
08.09.2023ZA06.01.2024

 

I would expect the following Values:

Invoice-DateProductPurchase Order (PO)Latest Invoice-Date for PO
01.12.2023XA06.01.2024
05.12.2023XB05.12.2023
06.01.2024YA06.01.2024
08.05.2022ZC08.05.2022
01.12.2023XB05.12.2023
08.09.2023ZA06.01.2024

 

Any Idea, how to adjust the Dax formula to receive the expected values?

 

Kind regards

1 ACCEPTED SOLUTION
some_bih
Super User
Super User

Hi @Philipp_ISARTAX possible solution, create measure as following

LatestInvoiceDate =
CALCULATE(
    MAX('Invoices_new'[Invoice_Date]),
    ALLEXCEPT('Invoices_new','Invoices_new'[PurchaseOrdrDate])
)
Adjust column and table names,
some_bih_0-1705492483722.png

 

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

1 REPLY 1
some_bih
Super User
Super User

Hi @Philipp_ISARTAX possible solution, create measure as following

LatestInvoiceDate =
CALCULATE(
    MAX('Invoices_new'[Invoice_Date]),
    ALLEXCEPT('Invoices_new','Invoices_new'[PurchaseOrdrDate])
)
Adjust column and table names,
some_bih_0-1705492483722.png

 

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.