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,
Tengo una tabla "Predicción de duración del evento" con valores de [Duración] para 01.01.2020 , 15.01.2020 y 31.01.2020 (se muestra a continuación)
Tengo una tabla de "Fechas" con [Fecha] de 01.01.2020 a 31.01.2020 (que se muestra a continuación) y hay una Relación de Fecha entre ambos.
A continuación planteo en el eje X mi "Tabla de fechas" [Fecha], y como eje Y mi "Predicción de duración del evento" [Duración] .
Mi objetivo es poder calcular (Interpolar) la Duración de cada día en la tabla [Fechas] (valores que se muestran a continuación como Naranja a continuación)
Por el momento sólo tengo los 3 valores representados como rojos
¿Alguna idea de cómo lograr eso?
Gracias de antemano,
Rui
Solved! Go to Solution.
Hola @trovisco (Rui),
Mirando la entrada de blog puedes adaptar el código a los siguientes https://community.powerbi.com/t5/Quick-Measures-Gallery/Linear-Interpolation/m-p/330712:
(gracias @Greg_Deckler )
Cree una medida con la sintaxis siguiente:
Interpolated Value =
VAR x3 = MAX(Dates[Date])
VAR match = CALCULATE(MAX('Event Duration Prediction'[Duration]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]=x3))
VAR x1 = CALCULATE(MAX('Event Duration Prediction'[Date]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]<=x3))
VAR x2 = CALCULATE(MIN('Event Duration Prediction'[Date]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]>=x3))
VAR y1 = CALCULATE(MAX('Event Duration Prediction'[Duration]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]<=x3))
VAR y2 = CALCULATE(MIN('Event Duration Prediction'[Duration]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]>=x3))
RETURN IF(NOT(ISBLANK(match));match;y1 + (x3 - x1) * (y2 - y1)/(x2 - x1))
Tenga en cuenta que el truco es no tener la tabla Date y la tabla Events relacionadas entre sí.
Cualquier pregunta, por favor, dígame.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHola @trovisco (Rui),
Mirando la entrada de blog puedes adaptar el código a los siguientes https://community.powerbi.com/t5/Quick-Measures-Gallery/Linear-Interpolation/m-p/330712:
(gracias @Greg_Deckler )
Cree una medida con la sintaxis siguiente:
Interpolated Value =
VAR x3 = MAX(Dates[Date])
VAR match = CALCULATE(MAX('Event Duration Prediction'[Duration]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]=x3))
VAR x1 = CALCULATE(MAX('Event Duration Prediction'[Date]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]<=x3))
VAR x2 = CALCULATE(MIN('Event Duration Prediction'[Date]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]>=x3))
VAR y1 = CALCULATE(MAX('Event Duration Prediction'[Duration]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]<=x3))
VAR y2 = CALCULATE(MIN('Event Duration Prediction'[Duration]);FILTER('Event Duration Prediction';'Event Duration Prediction'[Date]>=x3))
RETURN IF(NOT(ISBLANK(match));match;y1 + (x3 - x1) * (y2 - y1)/(x2 - x1))
Tenga en cuenta que el truco es no tener la tabla Date y la tabla Events relacionadas entre sí.
Cualquier pregunta, por favor, dígame.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering 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 |