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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

MAX Date per Material where Measure > 0

Hi, what I am trying to do is to get the maximum date by Material. I'm using datasets, tables with attributes, and tables with measures. 

 

DAX:

EVALUATE
SUMMARIZECOLUMNS (
    'Material'[MAT WRIN0],
    'Delivery Date'[DLVD Date],
    'Purchase Order'[PO Number],

    FILTER (
        VALUES ( 'Distributor'[DIST Country] ),
        ( 'Distributor'[DIST Country] = "Romania" )
    ),
    FILTER (
        VALUES ( 'Purchase Order'[PO Status Description] ),
        ( 'Purchase Order'[PO Status Description] = "Purchase order APPROVED" )
    ),

    "Purchase Order To Be Received Quantity", [Purchase Order To Be Received Quantity]
    )
ORDER BY 'Delivery Date'[DLVD Date]

 

Here is the data extract, and the final result should be like WRIN0 and Max DLVD Date (just one line per WRIN0).

NewUserHI21_0-1654768075161.png

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

please use

 

EVALUATE
FILTER (
    SUMMARIZECOLUMNS (
        'Material'[MAT WRIN0],
        'Delivery Date'[DLVD Date],
        'Purchase Order'[PO Number],
        FILTER (
            VALUES ( 'Distributor'[DIST Country] ),
            ( 'Distributor'[DIST Country] = "Romania" )
        ),
        FILTER (
            VALUES ( 'Purchase Order'[PO Status Description] ),
            ( 'Purchase Order'[PO Status Description] = "Purchase order APPROVED" )
        ),
        "Purchase Order To Be Received Quantity", [Purchase Order To Be Received Quantity]
    ),
    'Delivery Date'[DLVD Date]
        = CALCULATE (
            MAX ( 'Delivery Date'[DLVD Date] ),
            ALLEXCEPT ( 'Material', 'Material'[MAT WRIN0] )
        )
)
ORDER BY 'Delivery Date'[DLVD Date]

 

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Anonymous 

please use

 

EVALUATE
FILTER (
    SUMMARIZECOLUMNS (
        'Material'[MAT WRIN0],
        'Delivery Date'[DLVD Date],
        'Purchase Order'[PO Number],
        FILTER (
            VALUES ( 'Distributor'[DIST Country] ),
            ( 'Distributor'[DIST Country] = "Romania" )
        ),
        FILTER (
            VALUES ( 'Purchase Order'[PO Status Description] ),
            ( 'Purchase Order'[PO Status Description] = "Purchase order APPROVED" )
        ),
        "Purchase Order To Be Received Quantity", [Purchase Order To Be Received Quantity]
    ),
    'Delivery Date'[DLVD Date]
        = CALCULATE (
            MAX ( 'Delivery Date'[DLVD Date] ),
            ALLEXCEPT ( 'Material', 'Material'[MAT WRIN0] )
        )
)
ORDER BY 'Delivery Date'[DLVD Date]

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

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