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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
DanielSagaon
Frequent Visitor

Last row value

Hello! I would like your help. I am looking to find the last row value per Product. How can I archive that using DAX: 

 

I want the column desirable result, is the last value from the last row:

 

WeekProductScoreDesirable result
Apr 14 - 20, 2019ASIN26426161
Apr 21 - 27, 2019ASIN26426261
Apr 28 - May 4, 2019ASIN26426162
Apr 14 - 20, 2019AEO126060
Apr 21 - 27, 2019AEO127160
Apr 28 - May 4, 2019AEO126363
Apr 14 - 20, 2019BIG456565
Apr 21 - 27, 2019BIG456065
Apr 28 - May 4, 2019BIG456560
Apr 14 - 20, 2019ZAZ896969
Apr 21 - 27, 2019ZAZ896769
Apr 28 - May 4, 2019ZAZ896467

 

I hope you can help me.

 

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @DanielSagaon 

I assume this is a calculated column. If so:

 

NewCol =
VAR PreviousDate_ =
    CALCULATE (
        MAX ( Table1[Week] ),
        Table1[Week] < EARLIER ( Table1[Week] ),
        ALLEXCEPT ( Table1, Table1[Product] )
    )
RETURN
    IF (
        ISBLANK ( PreviousDate_ ),
        Table1[Score],
        CALCULATE (
            DISTINCT ( Table1[Score] ),
            Table1[Week] = PreviousDate_,
            ALLEXCEPT ( Table1, Table1[Product] )
        )
    )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

View solution in original post

3 REPLIES 3
Nathaniel_C
Super User
Super User

Hi @DanielSagaon ,

This doesn't appear to show what you are asking. These three are the same product, and I would expect a 61 in each row.

WeekProductScoreDesirable result
Apr 14 - 20, 2019ASIN26426161
Apr 21 - 27, 2019ASIN26426261
Apr 28 - May 4, 2019ASIN26426162



Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





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

Proud to be a Super User!




AlB
Super User
Super User

Hi @DanielSagaon 

I assume this is a calculated column. If so:

 

NewCol =
VAR PreviousDate_ =
    CALCULATE (
        MAX ( Table1[Week] ),
        Table1[Week] < EARLIER ( Table1[Week] ),
        ALLEXCEPT ( Table1, Table1[Product] )
    )
RETURN
    IF (
        ISBLANK ( PreviousDate_ ),
        Table1[Score],
        CALCULATE (
            DISTINCT ( Table1[Score] ),
            Table1[Week] = PreviousDate_,
            ALLEXCEPT ( Table1, Table1[Product] )
        )
    )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

Hi!! Thank you so much!! this is exactly what I was looking for!!!!

 

Really helpful!!

 

Thank you!!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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