Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
rsbin
Super User
Super User

Desviación estándar produce error NaN

Buenas tardes todos y @Greg_Deckler

Seguimiento de mi rosca anterior en la que utilicé la siguiente fórmula para calcular la desviación estándar:

StdDev_EquipID de la casa de los 200 es.
VAR __table - SUMMARIZE(GeneralStatistics,[Date],"__EquipID",[EquipmentIDRatio])
DEVOLVER STDEVX. P(__table,[__EquipID])

Hay varios puntos de datos donde mi denominador (TotalVisits) es un cero y por lo tanto creen que esto es lo que me está dando un error "NaN" en mi cálculo STDDEV.

NaN error.png

Apreciaría consejos sobre cómo corregir la fórmula anterior para ignorar los registros de línea en los que TotalVisits es 0.

Gracias de antemano y saludos,

6 REPLIES 6
AlexisOlson
Super User
Super User

La fórmula es correcta. La desviación estándar no está definida para un denominador cero.

Si desea mostrar algo más en lugar de NaN puede escribir esa regla en su medida:

StdDev_EquipID =
VAR __table =
    SUMMARIZE ( GeneralStatistics, [Date], "__EquipID", [EquipmentIDRatio] )
VAR SD =
    STDEVX.P ( __table, [__EquipID] )
RETURN
    IF ( ISERROR ( SD ), BLANK (), SD )
edhans
Super User
Super User

¿No puedes simplemente filtrarlos así?

VAR __table =
    SUMMARIZE(
        FILTER(
            GeneralStatistics,
            TotalVisits <> 0
        ),
        [Date],
        "__EquipID", [EquipmentIDRatio]
    )
RETURN
    STDEVX.P(
        __table,
        [__EquipID]
    )


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans Gracias amablemente por la respuesta. La misma solución que @az38 .... sólo te ganó a ella.

Le agradezco que cante y confirme la solución.

All the Best

Hey, no hay problema @rsbin - fue más rápido con la tecla enter!

Kudos/Thumbs arriba siguen siendo bienvenidos. En cualquier caso, me alegro de que su problema se resuelva y que su proyecto siga adelante.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
az38
Community Champion
Community Champion

@rsbin

Tratar

StdDev_EquipID =
VAR __table = SUMMARIZE(FILTER(GeneralStatistics, GeneralStatistics[TotalVisits] <> 0),[Date],"__EquipID",[EquipmentIDRatio])
RETURN STDEVX.P(__table,[__EquipID])

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Gracias @az38 !! Aprecio la rápida respuesta. Sabía que necesitaba un filtro en algún lugar, simplemente no podía conseguir la sintaxis correcta.

Gracias de nuevo y todo lo mejor.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.