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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ezeanya
Regular Visitor

Obtain values of a previous row on the same column

I need some help.

 

I'm trying to calculate the values of the Cal-production. it looks at EI column values and sum of previous results in cal-prod. if the sum of both are > than ROP column, it should display a number 800.

 

I can do that in Excel (see below), but I'm struggling to get that in Power BI

 

Cal-production ( in excel) D3 = IF(SUM(D2,B3)>C3,0,800)

 EIROPCal - production
1/1/2021144013930
2/1/202110151393800
3/1/202171413930
4/1/20214981393800
5/1/202124814420
4 REPLIES 4
ezeanya
Regular Visitor

This is what i get

 

Excel 0, 800,0,800

DAX 0,800,0,0

amitchandak
Super User
Super User

@ezeanya , Create a new column like

new column =
var _1 = maxx(filter(Table1, Table1[Date] < earlier(Table1[Date]) ), [Date])
return
if(maxx(filter(Table1, Table1[Date] =_1 ), [EL]) >[ROP], 800,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  i forgot to mention that the D4 in the excel will be =IF(SUM(D3,B4,D2)>C4,0,800)

 

every new cell in a row has to add all the previous results

D3 = IF(SUM(D2,B3)>C3,0,800)

D4 = IF(SUM(D3,B4,D2)>C4,0,800)

D5 = =IF(SUM(D4,B5,D3,D2)>C5,0,800)

Till December month

@amitchandak 

Thanks for the respond. the ROP data is coming from measure data. So the earlier function is not working when I use this for a new measure. I tried using 

New Column =
VAR
var_1 = maxx(filter(ALLSELECTED(Table1[Date]), Table1[Date] < (Table1[Date])), Table1[Date])
return

if(maxx(filter(Table1, Table1[Date] =var_1 ), [EL]) > [ROP], 800,0)
 
but the results were different.
 
 
 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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