cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeyare
Helper I
Helper I

Incremento del valor de fecha anterior

Hola

no puede encontrar una solución para la caliculción de incrementos en función de pocas condiciones.

Ejemplo de tabla actual en mi Power Query:

FechaPersonaRendimiento
4.4.2020A10
4.4.2020B12
4.4.2020C8
4.4.2020D15
5.4.2020A12
5.4.2020B16
5.4.2020C10
5.4.2020D5
6.4.2020A9
6.4.2020B8
6.4.2020C11
6.4.2020D7
7.4.2020A6
7.4.2020B4
7.4.2020C20
7.4.2020D11


Solución esperada:

Necesito calcular el incremento de la columna "rendimiento" basado en el valor de fecha anterior incluir la evaluación de la columna "persona":

fecha 4.4.2020 para persona - A hay rendimiento 10

fecha 5.4.2020 para la persona - A hay rendimiento 12

entonces el incremento es de 2

FechaPersonaRendimientoIncremento
4.4.2020A100
4.4.2020B120
4.4.2020C80
4.4.2020D150
5.4.2020A122
5.4.2020B164
5.4.2020C102
5.4.2020D5-10
6.4.2020A9-3
6.4.2020B8-8
6.4.2020C111
6.4.2020D72
7.4.2020A6-3
7.4.2020B4-4
7.4.2020C209
7.4.2020D114

Thx para una ayuda.

J.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User IV
Super User IV

Así que básicamente, como en el artículo al que se hace referencia, algo así como:

Increment Column =
  VAR __Current = [performance]
  VAR __PreviousDate = MAXX(FILTER('Table',[person] = EARLIER([person]) && [date] < EARLIER([date])),[date])
  VAR __Previous = MAXX(FILTER('Table',[person] = EARLIER([person]) && [date] = __PreviousDate),[performance])
RETURN
  __Current - __Previous

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

8 REPLIES 8
amitchandak
Super User IV
Super User IV

@jeyare ,

Trate como


diff ?
var _last á maxx(filter(Table,table[person]-earlier(table[person]) && table[Date] á anterior(table[Date])-1),table[performance])
devolución
if(isblank(_last),0,performance-_last)



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Greg_Deckler
Super User IV
Super User IV

Así que básicamente, como en el artículo al que se hace referencia, algo así como:

Increment Column =
  VAR __Current = [performance]
  VAR __PreviousDate = MAXX(FILTER('Table',[person] = EARLIER([person]) && [date] < EARLIER([date])),[date])
  VAR __Previous = MAXX(FILTER('Table',[person] = EARLIER([person]) && [date] = __PreviousDate),[performance])
RETURN
  __Current - __Previous

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

thx, parece estar bien hasta la primera fila, cuando recibo un error:

No se puede determinar el valor de 'performance'. O bien 'performance' no existe o no hay ninguna fila actual para una columna denominada 'Tperformance'.

Entonces IF necesita estar allí, pero no está seguro de dónde

mi respuesta fue para @Greg_Deckler

Hmm, véase PBIX adjunto. No puedo decir lo que salió mal, pero el PBIX parece funcionar bien.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




thx @Greg_Deckler , mi culpa

¡No te preocupes! ¡Me alegro de que lo hayamos resuelto! 🙂

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Greg_Deckler
Super User IV
Super User IV

Vea mi artículo sobre el tiempo medio entre el error (MTBF) que utiliza EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors