cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tito1986 New Member
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

Accepted Solutions
Moderator v-caliao-msft
Moderator

Re: Previous rows power pivot

@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
Moderator v-caliao-msft
Moderator

Re: Previous rows power pivot

@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

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors