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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
fahadarshad
Helper I
Helper I

Getting max date and then an accompanying column

Hello everyone

 

I have a table where I have captued the customer ID and the list of products they purchased and when (date/time).

From this I want to know which was the last product they purchased.

 

But I cannot seem to figure out the method to extract this result.

Here is what my data looks like and the expected result.

Kindly assist.

 

Untitled.png

1 ACCEPTED SOLUTION

@fahadarshad

 

If you need a Table

 

Go to Modelling Tab>>>NEW TABLE and then use this formula.

 

 

New Table =
SUMMARIZE (
    TableName,
    TableName[Customer ID],
    "Last Date", MAX ( TableName[Date] ),
    "Last Product", CALCULATE (
        FIRSTNONBLANK ( TableName[Product], 1 ),
        FILTER ( TableName, TableName[Date] = MAX ( TableName[Date] ) )
    )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

11 REPLIES 11

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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