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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ConstMoss
Helper I
Helper I

latest product for on a given transaction

Hello everyone - i am trying to figure out how to get the last/latest product for a given transaction based on the line number as shown below. any idea how to do this?

 

Untitled2.png

2 ACCEPTED SOLUTIONS
Sean
Community Champion
Community Champion

@ConstMoss

This seems to work! Smiley Happy

Column =
CALCULATE (
    FIRSTNONBLANK ( 'Table'[ProductName], 1 ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[TransactionNum] ),
        'Table'[LineNum]
            = CALCULATE (
                MAX ( 'Table'[LineNum] ),
                ALLEXCEPT ( 'Table', 'Table'[TransactionNum] )
            )
    )
)

Latest Product.png

View solution in original post

Ashish_Mathur
Super User
Super User

Hi @ConstMoss,

 

Try this calculated column formula

 

=LOOKUPVALUE([ProductName],[LineNum],CALCULATE(MAX([LineNum]),FILTER(Data,[TransactionNum]=EARLIER([TransactionNum]))),[TransactionNum],[TransactionNum])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi @ConstMoss,

 

Try this calculated column formula

 

=LOOKUPVALUE([ProductName],[LineNum],CALCULATE(MAX([LineNum]),FILTER(Data,[TransactionNum]=EARLIER([TransactionNum]))),[TransactionNum],[TransactionNum])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Sean
Community Champion
Community Champion

@ConstMoss

This seems to work! Smiley Happy

Column =
CALCULATE (
    FIRSTNONBLANK ( 'Table'[ProductName], 1 ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[TransactionNum] ),
        'Table'[LineNum]
            = CALCULATE (
                MAX ( 'Table'[LineNum] ),
                ALLEXCEPT ( 'Table', 'Table'[TransactionNum] )
            )
    )
)

Latest Product.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.