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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Get previous row value

AnaStone_100_0-1646226329663.png

 

I need to get previous row value (Result column) and need help. I tried DAX but its only giving me partial result.
The values should be previous rows taken from MyMeasure1. 
My measure 1 is the DAX below, which is the cumulative calculated for Sales for each market and it is based on the Days column.

 

RunningSum=

CALCULATE(

SUM( 'TABLE'[sales] ),

FILTER(

ALLSELECTED('TABLE'),

 TABLE'[Market_name]=MAX('TABLE'[market_name]) &&

'TABLE'[Days]>=MAX('TABLE'[Days])))

 

I appreciate any help.

Thanks.

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

Hi, @Anonymous 

 

An optional option:
Step 1: Create an index column (you can add an index column through the UI in PowerQuery)
Step 2: Create the following measure

 

_getResult = 
var _currentIndex=MAX('Table'[Index])
return 
CALCULATE([My measure1 as Measure],FILTER(ALL('Table'),'Table'[Index]=_currentIndex-1))
////Assuming [My measure1 as Measure] is your measure1

 

Result:

vangzhengmsft_0-1646621097784.png

Please refer to the attachment below for details. Hope this helps.

 

If this doesn't work for you, please consider sharing a sample.

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

3 REPLIES 3
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

An optional option:
Step 1: Create an index column (you can add an index column through the UI in PowerQuery)
Step 2: Create the following measure

 

_getResult = 
var _currentIndex=MAX('Table'[Index])
return 
CALCULATE([My measure1 as Measure],FILTER(ALL('Table'),'Table'[Index]=_currentIndex-1))
////Assuming [My measure1 as Measure] is your measure1

 

Result:

vangzhengmsft_0-1646621097784.png

Please refer to the attachment below for details. Hope this helps.

 

If this doesn't work for you, please consider sharing a sample.

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

 

Best Regards,
Community Support Team _ Zeon Zheng

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Tahreem24
Super User
Super User

@Anonymous , Create a measure like this:

Prev Row Measure =
VAR res_ = CALCULATE([Running Sum Measure],FILTER(

ALLSELECTED('TABLE'),TABLE'[Market_name]=MAX('TABLE'[market_name]) &&'TABLE'[Days]>MAX('TABLE'[Days])))
RETURN IF(res_=BLANK(),[Running Sum Measure],res_)

 

I tried with some dummy data at my side:

Capture.JPG

 

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

Thanks for the help, but it didnt work.

I did the same DAX but the result I get is not correct, you get different result maybe beacuse you dont have addiitonal grouping in your data for the Days column. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors