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.
Tengo datos en el siguiente formato
Fecha | Precio |
15-12-20 | 100 |
14-12-20 | 50 |
13-12-20 | 20 |
12-12-20 | 10 |
Me gustaría crear una medida que pueda calcular las devoluciones diarias con la siguiente fórmula
Fecha | Precio | Devuelve |
15-12-20 | 100 | (100-50)/50 |
14-12-20 | 50 | (50-20)/20 |
13-12-20 | 20 | (20-10)/10 |
12-12-20 | 10 | 0 |
Solved! Go to Solution.
@Sachy123 , Pruebe una nueva columna como
nueva columna ?
var _max á maxx(table,[Date] < earlier([Date])),[Date])
devolución
[Precio] - maxx(filter(table, [Fecha] á _max),[Precio])
O
nueva columna ?
var _max á maxx(table,[Date] < earlier([Date])),[Date])
var _1 á maxx(table, [Fecha] - _max),[Precio])
devolución
divide([Price] - _1,_1)
finalmente este funciona como un encanto
nueva columna ?
var _max á maxx(table,[Date] < earlier([Date])),[Date])
var _1 á maxx(table, [Fecha] - _max),[Precio])
devolución
divide([Price] - _1,_1)
No @Sachy123,
Lo siento, esta es mi negligencia. Debe ser crear una columna calculada, no crear una medida. Cometí un error arriba
Saludos
Liu Yang
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola chicos, obtengo un subrayado rojo cuando uso la función EARLIER y no hay autosuggestions.
@Sachy123 , Pruebe una nueva columna como
nueva columna ?
var _max á maxx(table,[Date] < earlier([Date])),[Date])
devolución
[Precio] - maxx(filter(table, [Fecha] á _max),[Precio])
O
nueva columna ?
var _max á maxx(table,[Date] < earlier([Date])),[Date])
var _1 á maxx(table, [Fecha] - _max),[Precio])
devolución
divide([Price] - _1,_1)
No @Sachy123,
Estos son los pasos que puede seguir:
1. Cree una columna calculada.
Return =
var _datamax=CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Date]<EARLIER('Table'[Date])))
var _price2=CALCULATE(MAX('Table'[Price]),FILTER('Table',[Date]=_datamax))
var _price1=CALCULATE(MAX('Table'[Price]))
var _final_price=(_price1-_price2)/_price2
return IF(_price2=0,BLANK(),_final_price)
2. Resultado
Puede descargar el archivo PBIX desde aquí.
Saludos
Liu Yang
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |