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
tito1986
New Member

Previous rows power pivot

Hi, hello from Ecuador, i am a big problem.

 

I have the following payroll information and I need to get the previous row to get the percentage increase per item month by month but I can not find the solution.


Here's the example:
I have this informationtable.PNG

 

Aditional, i have two measure for this data:
 
TOT_INGRESOS:=CALCULATE(SUM('Nomina'[valor]);Nomina[tipo rubro]="ingreso")
TOT_EGRESOS:=CALCULATE(SUM('Nomina'[valor]);Nomina[tipo rubro]="descuento")
 
When you insert a PivotTable i need the folowing:
Create a measure that returns the value of the previous row for each item.
 
Previos rows.PNG
 

I have many items of income and deduction, and there are months in which I have no values.
 
your help please.
1 ACCEPTED SOLUTION
v-caliao-msft
Employee
Employee

@tito1986,

 

In DAX you can’t reference the previous row in any way because there is no order to the rows. In your scenairo, you need to get previous month's value, so you need to sort your data by date. And then get previous value by using LOOKUPVALUE function.

PreviousValue = LOOKUPVALUE(Table1[Amount],Table1[Order],Table1[Order]-1)

Capture.PNG

 

Regards,

Charlie Liao

View solution in original post

1 REPLY 1
v-caliao-msft
Employee
Employee

@tito1986,

 

In DAX you can’t reference the previous row in any way because there is no order to the rows. In your scenairo, you need to get previous month's value, so you need to sort your data by date. And then get previous value by using LOOKUPVALUE function.

PreviousValue = LOOKUPVALUE(Table1[Amount],Table1[Order],Table1[Order]-1)

Capture.PNG

 

Regards,

Charlie Liao

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.