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
vrossouw
Helper III
Helper III

Info from previous row if result was measure

Hi

I want to write a measure to find the result from a measure from a previous row, by date and part number.

The SOH column is the result of a measure.

The required result must also be a measure, reading from the previous row, by date and by part.

Spoiler
Part NumberTransaction DateSOH (measure)Required result
AA01 January 201932 
AA15 January 20195532
AA17 January 20197555
AA04 February 20196175
AA05 February 20195161
AA06 February 20194151
BB06 February 2019200
BB07 February 20192020

Thank you,

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @vrossouw 

Create a calculated column

RANK = RANKX(FILTER('Table','Table'[Part Number]=EARLIER('Table'[Part Number])),[Transaction Date],,ASC,Dense)

Create a measure

Measure 2 = CALCULATE([Measure],FILTER(ALLEXCEPT('Table','Table'[Part Number]),'Table'[RANK]=MAX('Table'[RANK])-1))

Capture2.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @vrossouw 

Create a calculated column

RANK = RANKX(FILTER('Table','Table'[Part Number]=EARLIER('Table'[Part Number])),[Transaction Date],,ASC,Dense)

Create a measure

Measure 2 = CALCULATE([Measure],FILTER(ALLEXCEPT('Table','Table'[Part Number]),'Table'[RANK]=MAX('Table'[RANK])-1))

Capture2.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It works perfectly, thank you Smiley Very Happy

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.