- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Obtener valores de la tabla para que la línea sea recta en el gráfico de líneas
¡Hola!
¿Cómo obtengo el valor de uno de los conjuntos para que la línea esté "interpolada"/recta entre donde tengo valores reales? El total para Comp 2020-10-05 solo debe usar 26,77 y no el promedio de 26,77 y 24,83. El mismo problema en 2020-10-12.
(Lo que no quiero es una caída / pico donde esté la línea discontinua gris. Lo que está sucediendo ahora es que Power BI toma el promedio ya que he seleccionado dos conjuntos de una segmentación de datos. Axis es categórico y necesita serlo para conseguir las brechas)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

¡De acuerdo!
Intentemos algo en el camino de esto en su lugar:
VAR PrevD = CALCULATE(AVERAGE(Fact_IntDay[Moving Average]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Dim_Machine_Comp[Name] in s ) , Fact_IntDay[DateDay] = PrevDate )
VAR NextD = CALCULATE(AVERAGE(Fact_IntDay[Moving Average]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Dim_Machine_Comp[Name] in s ) , Fact_IntDay[DateDay] = NextDate )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hola @AnnaMagnusson ,
¿El valor que buscas es 25,61 para 2020-10-12?
Br
Johannes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hola
Si estoy pensando correctamente se va a complicar un poco, pero estoy pensando algo a lo largo de lo siguiente:
var s = ALLSELECTED(Dim_Machine_Comp[Name])
var d = CALCULATE(AVERAGE(Fact_IntDay[Moving Average]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Dim_Machine_Comp[Name] in s ))
// The current row (date) thats being calculated
VAR CurrentDay = SELECTEDVALUE(Calendar[Date])
// The date of the most recent output value
VAR PrevDate = CALCULATE(MAX(Fact_IntDay[DateDay]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Fact_IntDay[Moving Average] <> BLANK() && Fact_IntDay[DateDay] < CurrentDay && Dim_Machine_Comp[Name] in s ))
// The date of the next output value
VAR NextDate =
= CALCULATE(MIN(Fact_IntDay[DateDay]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Fact_IntDay[Moving Average] <> BLANK() && Fact_IntDay[DateDay] > CurrentDay && Dim_Machine_Comp[Name] in s ))
// The length of the gap
VAR Gap = NextDate - PrevDate
// The difference between the current row and the previous row
VAR CurrentDiff = CurrentDay - PrevDate
// The previous output value
VAR PrevD = Calculate( d , ALL(Calendar) , Calendar[Date] = PrevDate )
// The next output value
VAR NextD = Calculate( d , ALL(Calendar) , Calendar[Date] = PrevDate )
// The final output
VAR OutputValue = PrevD + ( Divide(NextD - PrevD , Gap , BLANK()) * CurrentDiff )
return
if(ISBLANK([Comp]),
OutputValue,
[Comp])
Esto solo se adapta para trabajar con fechas en el eje X, si funciona con fechas debería poder aplicar el mismo principio a las horas. También debe tener en cuenta brechas más grandes que una sola unidad (si hay una brecha de dos días, la primera fila debe tener 1/3 de la diferencia y la segunda debe tener 2/3)
Es muy difícil escribir esto sin poder probarlo, pero hágame saber cómo va.
Br
J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Se supone que CurrentDay devuelve la fecha de la fila que se está evaluando,
Intente usar SELECTEDVALUE(Fact_IntDay[DateDay]) en su lugar.
Si solo intenta devolver [CurrentDay], debería ver las mismas fechas que las que se muestran en la columna DateDay.
/ J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@tex628 De acuerdo, ese funciona ahora y también lo hace Prevdate och Nextdate!
El siguiente problema es Gap. Obtengo valores / fecha para 2020-10-03 como 1900-01-01 en el set A y solo 2020-10-02 en todo B 😅 ¿alguna idea sobre por qué?
Lo siento por el spam, es solo que he estado tratando de hacer esto durante semanas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

¡Ahh es mi mal!
AR Gap = Value(NextDate - PrevDate)
Deberá hacer lo mismo con CurrentDiff.
Además, ¿puede mostrar los resultados de PrevDate?
/ J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Si tiramos de estas dos medidas, ¿qué fechas estamos recibiendo?
PrevDate =
var s = ALLSELECTED(Dim_Machine_Comp[Name])
var d = CALCULATE(AVERAGE(Fact_IntDay[Moving Average]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Dim_Machine_Comp[Name] in s ))
// The current row (date) thats being calculated
VAR CurrentDay = SELECTEDVALUE(Fact_IntDay[DateDay])
// The date of the most recent output value
VAR PrevDate = CALCULATE(MAX(Fact_IntDay[DateDay]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Fact_IntDay[Moving Average] <> BLANK() && Fact_IntDay[DateDay] < CurrentDay && Dim_Machine_Comp[Name] in s ))
Return
PrevDate
NextDate =
var s = ALLSELECTED(Dim_Machine_Comp[Name])
var d = CALCULATE(AVERAGE(Fact_IntDay[Moving Average]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Dim_Machine_Comp[Name] in s ))
// The current row (date) thats being calculated
VAR CurrentDay = SELECTEDVALUE(Fact_IntDay[DateDay])
// The date of the next output value
VAR NextDate =
= CALCULATE(MIN(Fact_IntDay[DateDay]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Fact_IntDay[Moving Average] <> BLANK() && Fact_IntDay[DateDay] > CurrentDay && Dim_Machine_Comp[Name] in s ))
Return
NextDate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@tex628 obtenemos esto:
(Tuve que cambiar algo en el código para que funcionara,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

¡Se ve bien!
Con estas fechas deberíamos poder obtener los valores Comp correspondientes.
En su imagen de arriba entre las fechas del 10-03 y 10-06 estoy buscando algo en la línea de esto:
/ J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@tex628 Así que estoy obteniendo casi exactamente lo que tienes para currentdiff excepto la fila superior, así que probablemente sea solo una pequeña cosa para ajustar o no importa. Pero para PrevD y NextD obtengo espacios en blanco para cuando no está en la misma fila que comp.
PrevD = calculate(d, Fact_Intday [DateDay] = PrevDate)
NextD = calculate(d, Fact_Intday [DateDay] = NextDate)
Dónde
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

¡De acuerdo!
Intentemos algo en el camino de esto en su lugar:
VAR PrevD = CALCULATE(AVERAGE(Fact_IntDay[Moving Average]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Dim_Machine_Comp[Name] in s ) , Fact_IntDay[DateDay] = PrevDate )
VAR NextD = CALCULATE(AVERAGE(Fact_IntDay[Moving Average]), all(Dim_Machine[Name]), FILTER(Dim_Machine_Comp, Dim_Machine_Comp[Name] in s ) , Fact_IntDay[DateDay] = NextDate )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
03-19-2024 09:31 PM | |||
01-26-2024 06:55 AM | |||
01-09-2024 12:09 PM | |||
09-06-2023 11:44 PM | |||
03-01-2024 03:17 AM |