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.
Hola a todos
Agradecería que alguien me ayudara por favor con mis medidas:
Tengo la siguiente tabla:
Fecha | Artículo | Precio |
01.01.2020 | A | 20 |
01.01.2020 | A | 25 |
01.01.2020 | A | 30 |
03.01.2020 | A | 20 |
10.01.2020 | A | 35 |
02.01.2020 | B | 50 |
05.01.2020 | B | 60 |
01.01.2020 | C | 40 |
01.01.2020 | C | 45 |
01.01.2020 | C | 50 |
03.01.2020 | C | 40 |
10.01.2020 | C | 45 |
He calculado el cambio porcentual para cada artículo tomando el precio promedio para el día basado en la segmentación de fecha de la siguiente manera:
Percent Change =
var _max = maxx(Table,Table[Date].[Date])
var _min = MINX(Table,Table[Date].[Date])
return
(CALCULATE(AVERAGE(Table[Price]), FILTER(ALLSELECTED(Table),Table[Date].[Date]=_max))-CALCULATE(AVERAGE(Table[Price]),FILTER(ALLSELECTED(Table),Table[Date].[Date]=_min)))/CALCULATE(AVERAGE(Table[Price]),FILTER(ALLSELECTED(Price),Table[Date].[Date]=_min))*100
Cuando selecciono elementos individuales, el porcentaje se calcula correctamente entre las fechas mínimas y máximas de la siguiente manera:
Pero cuando selecciono todos los artículos, obtengo diferentes cambios porcentuales
¿Puede alguien ayudarme a obtener los cambios porcentuales correctos cuando selecciono todos los elementos (los mismos valores que cuando selecciono un solo elemento)? Me gustaría presentar cambios para todos los elementos de una tabla.
Gracias
Solved! Go to Solution.
@dashbuilder, he creado tres versiones de la misma, por favor, echa un vistazo a los que están en el archivo adjunto después de la firma
@dashbuilder , Crear una tabla de fechas independiente y, a continuación, pruebe la misma fórmula con la tabla de fechas
ejemplo -
Cambio de porcentaje ?
var _max á maxx('DATE','DATE'[Date])
var _min á MINX('DATE','DATE'[Date])
devolución
(CALCULATE(AVERAGE(Table[Price]), FILTER(ALLSELECTED('DATE'),'DATE'[Date]-_max))
-CALCULATE(AVERAGE(Table[Price]),FILTER(ALLSELECTED('DATE'),'DATE'[Date]-_min)))/
CALCULATE(AVERAGE(Table[Price]),FILTER(ALLSELECTED('DATE'),'DATE'[Date]-_min))*100
Además, utilice la función de división
@amitchandak agradezco su respuesta. He creado una nueva tabla de datos de la siguiente manera
Entonces, alteré la fórmula como se sugiere:
Percent Growth =
var _max = maxx('DATE','DATE'[Date])
var _min = MINX('DATE','DATE'[Date])
return
DIVIDE((CALCULATE(AVERAGE(Table[Price]), FILTER(ALLSELECTED('DATE'),'DATE'[Date]=_max))
-CALCULATE(AVERAGE(Table[Price]),FILTER(ALLSELECTED('DATE'),'DATE'[Date]=_min))),
CALCULATE(AVERAGE(Table[Price]),FILTER(ALLSELECTED('DATE'),'DATE'[Date]=_min)))*100
Ahora, obtengo "0"s:
¿Estoy haciendo algo malo? Gracias montones.
@dashbuilder, he creado tres versiones de la misma, por favor, echa un vistazo a los que están en el archivo adjunto después de la firma
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 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |