Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hola Comunidad,
Me podrían ayudar con la función dax para calcular a partir de un valor anterior de la misma columna, para sumar o restar dicho valor las columnas adyacentes: Faltante al Plan y Surtido de mas al plan.
Ejemplo de excel:
Para calcular el Faltante acumulado por día, debo tomar en cuenta el valor del resultado del día anterior, para validar si fue mayor a cero y como resultado de esa validación, restar el faltante al plan - surtido de mas al plan, si no es mayor a cero entonces deberá sumar el valor anterior + faltante al plan + surtido de mas al plan.
¿Cómo lo hago en dax?
Gracias por la ayuda!!
Saludos.
Solved! Go to Solution.
Hi @Anonymous ,
According to my understanding, you want to calculate the sum based on previous row, right?
You could use the following formula after adding an “ Index column ” in Query Editor :
// create a new column
HMinusI =
'Previous' [H] - 'Previous' [I]
// Calculate sum
accumulated =
VAR a =
CALCULATE (
MAX ( Previous[Index] ),
FILTER ( ALL ( Previous ), [HMinusI] < 0 && [Index] <= MAX ( Previous[Index] ) )
)
RETURN
IF (
ISBLANK ( a ),
MAX ( Previous[HMinusI] ),
CALCULATE (
SUM ( Previous[HMinusI] ),
FILTER ( ALL ( Previous ), [Index] >= a && [Index] <= MAX ( Previous[Index] ) )
)
)My visualization looks like this:
Is the result what you want? If not, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best regards,
Eyelyn Qin
Equipo, por favor su ayuda con este ejercicio
Tengo mi inventario al cierre de la seman 48 que es 2594 y quiero proyectarlo en las siguientes semanas sumnado la acumulación de paletas,
cómo haria para que en los espacios en blanco aparesca el resultado de lo escrito a mano alzada.
Muchas gracias comunidad
Sldos
Hi @Anonymous ,
According to my understanding, you want to calculate the sum based on previous row, right?
You could use the following formula after adding an “ Index column ” in Query Editor :
// create a new column
HMinusI =
'Previous' [H] - 'Previous' [I]
// Calculate sum
accumulated =
VAR a =
CALCULATE (
MAX ( Previous[Index] ),
FILTER ( ALL ( Previous ), [HMinusI] < 0 && [Index] <= MAX ( Previous[Index] ) )
)
RETURN
IF (
ISBLANK ( a ),
MAX ( Previous[HMinusI] ),
CALCULATE (
SUM ( Previous[HMinusI] ),
FILTER ( ALL ( Previous ), [Index] >= a && [Index] <= MAX ( Previous[Index] ) )
)
)My visualization looks like this:
Is the result what you want? If not, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
Best regards,
Eyelyn Qin
You create a calculated measure that captures the current day value, and then filters all values by the largest day that is smaller than your current day. That way you get access to the "previous" "row". (it's not actually a row, more a context)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 31 | |
| 28 | |
| 24 |