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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Diferencia de valor por fecha y variable categórica

Hola a todos

Quiero calcular la diferencia entre los valores, en función de la fecha, así como de otra variable categórica.

Todo lo que se debe mostrar en un diagrama de cascada (columna Resultado esperado). Adjuntí una captura de pantalla con datos ficticios y el resultado de la expectancia.

Gracias de antemano!

PBi Question.PNG

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

Hola @angryvoegi ,

En función de su descripción, puede realizar algunos pasos de la siguiente manera.

  1. Cree una columna para marcar el mes.

Mes - MES('Diff'[Fecha])

2. Cree una nueva medida.

Valor de la prueba ?

var x1-MAXX(FILTER(ALL(Diff),[Month]-SELECTEDVALUE(Diff[Month])&&'Diff'[Cat]-SELECTEDVALUE(Diff[Cat])),'Diff'[Value])

var x2-MAXX(FILTER(ALL(Diff),[Month]-SELECTEDVALUE(Diff[Month])-1&&'Diff'[Cat]-SELECTEDVALUE(Diff[Cat])),'Diff'[Value])

devolución

x1-x2

Resultado:

v-yuaj-msft_0-1607301414935.png

Espero que eso sea lo que estabas buscando.

Saludos

Yuna

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hola

Pruebe esta fórmula de columna calculada

•data[value]-lookupvalue(data[value],data[date],calculate(max(data[date]),filter(data,data[cat]-earlier(data[cat])&&&&data[date]<earlier(data[date]))),data[cat],data[cat])

Espero que esto ayude.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yuaj-msft
Community Support
Community Support

Hola @angryvoegi ,

En función de su descripción, puede realizar algunos pasos de la siguiente manera.

  1. Cree una columna para marcar el mes.

Mes - MES('Diff'[Fecha])

2. Cree una nueva medida.

Valor de la prueba ?

var x1-MAXX(FILTER(ALL(Diff),[Month]-SELECTEDVALUE(Diff[Month])&&'Diff'[Cat]-SELECTEDVALUE(Diff[Cat])),'Diff'[Value])

var x2-MAXX(FILTER(ALL(Diff),[Month]-SELECTEDVALUE(Diff[Month])-1&&'Diff'[Cat]-SELECTEDVALUE(Diff[Cat])),'Diff'[Value])

devolución

x1-x2

Resultado:

v-yuaj-msft_0-1607301414935.png

Espero que eso sea lo que estabas buscando.

Saludos

Yuna

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Anonymous
Not applicable

Hola, muchas gracias por su ayuda!! Funcionó perfectamente 🙂

¡Gracias de nuevo!

amitchandak
Super User
Super User

@angryvoegi , Pruebe una nueva columna como

nueva columna ?
var _max á maxx(filter(Table, [cat] ?earlier([cat]) && [Date] <earlier([Date])),[Fecha])
devolución
[valor] - maxx(filter(Table, [cat] ?earlier([cat]) && [Date] ?_max),[value])

Anonymous
Not applicable

@amitchandak ¡Muchas gracias por su respuesta!

Desafortunadamente obtengo un error ("la sintaxis para la devolución es incorrecta").

Gracias de nuevo 🙂

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors