Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Quiero tener una medida que muestre 1 cuando un estado haya cambiado y 0 cuando el estado sea el mismo que el valor de ayer. Mi conjunto de datos es bastante grande, por lo que quiero evitar usar una columna calculada si es posible.
Siento que estoy muy cerca de tener el DAX correcto, pero esta medida no me está dando el resultado que estoy buscando.
Change Status Flag =
INT (
COUNTROWS (
FILTER (
'Table',
'Table'[Key]
= EARLIER ( 'Table'[Key] )
&& 'Table'[Status]
<> EARLIER ( 'Table'[Status] )
&& 'Table'[Snapshot Date]
= EARLIER ( 'Table'[Snapshot Date] )
)
) > 0
)
Lo que estoy recibiendo -
Valor establecido en 1 aunque el estado del día anterior no haya cambiado
Lo que quiero:
Marque solo las filas donde el estado es diferente al de ayer.
¿Alguien podría ayudarme con el DAX para lograr esto? Gracias de antemano por su ayuda.
Se adjuntan mis datos de muestra.
Snapshot DateKeyStatus
|
Hasta ahora, pocos usuarios optan por las funciones de ventana; Tal vez pocos tienen una comprensión profunda de ellos.
Espero que las funciones de la ventana sean más eficientes en tales escenarios que FILTER() de la "vieja escuela".
Tomo Kudos en cualquier momento. ¡Me alegro de poder ayudar!
Esto funciona brillantemente y es muy útil tenerlo en el arsenal. Muchas gracias @foodd , hiciste mi viernes por la noche!
Establezca la columna personalizada para que sea:
Change Status Flag =
VAR CurrentDate = 'Table'[Snapshot Date]
VAR CurrentKey = 'Table'[Key]
VAR CurrentStatus = 'Table'[Status]
VAR PreviousStatus =
CALCULATE(
FIRSTNONBLANK('Table'[Status], 1),
FILTER(
'Table',
'Table'[Snapshot Date] = CurrentDate - 1 &&
'Table'[Key] = CurrentKey
)
)
RETURN IF(ISBLANK(PreviousStatus), 0, IF(CurrentStatus <> PreviousStatus, 1, 0))
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.