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
Anonymous
Not applicable

Calcule CAGR de varios años mientras ignora el filtro de segmentación para la fecha

Estoy buscando crear una medida CAGR de 5 años que no se vea afectada por la segmentación del año de fecha que filtra todos los demás datos de la tabla a un año específico. Ejemplo: 2016-2020 CAGR, pero todos los demás datos de la tabla deben mostrar solo los cálculos para 2020 basados en el filtro de segmentación de datos.

Fórmulas que estoy usando para calcular CAGR el primer año en el conjunto de datos es 2016 y el último año es 2020 - períodos de inicio y fin de CAGR:

1 Valor inicial: CALCULATE(SUM(table[revenue]),FILTER(table,table[year]-MIN(table[year])))

1 Valor final: CALCULATE(SUM(table[revenue]),FILTER(table,table[year]-MAX(table[year]
1o de Años (MAX(tabla[año])-MIN(tabla[año]))
1 CAGR á IFERROR(([1 Valor final]/[1 Valor inicial])-(1/([1 - de años])-1),0)

Por favor, aconseje cómo no filtrar las fórmulas de valor inicial y final en función de la segmentación de un año en la tabla.

Gracias

1 ACCEPTED SOLUTION

Hola @DataNewbie

Construyo una nueva mesa para hacerme una prueba.

Industry_Revenue Tabla:

1.png

Luego construyo una nueva medida:

Cagr_Industry = 
VAR _BeginningValue =
    CALCULATE (
        SUM ( 'Industry_Revenue'[Revenue] ),
        FILTER (
            ALL ( 'Industry_Revenue' ),
            'Industry_Revenue'[year]
                = MINX ( ALL ( 'Industry_Revenue' ), 'Industry_Revenue'[year] )
                && Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        )
    )
VAR _EndingValue =
    CALCULATE (
        SUM ( 'Industry_Revenue'[Revenue] ),
        FILTER (
            ALL ( 'Industry_Revenue' ),
            'Industry_Revenue'[year]
                = MAXX ( ALL ( 'Industry_Revenue' ), 'Industry_Revenue'[year] )
                && Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        )
    )
VAR _MinYear =
    MINX (
        FILTER (
            ALL ( 'Industry_Revenue' ),
            Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        ),
        'Industry_Revenue'[year]
    )
VAR _MaxYear =
    MAXX (
        FILTER (
            ALL ( 'Industry_Revenue' ),
            Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        ),
        'Industry_Revenue'[year]
    )
VAR _ofYears =
    DATEDIFF ( _MinYear, _MaxYear, YEAR )
RETURN
    IFERROR ( ( _EndingValue / _BeginningValue ) ^ ( 1 / ( _ofYears - 1 ) ), 0 )

Resultado:

Predeterminado:

2.png

Seleccione 2018 en Slicer:

3.png

Puede descargar el archivo pbix desde este enlace: Calcular CAGR de varios años mientras ignora el filtro de segmentación de datos para la fecha

Saludos

Rico Zhou

Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

5 REPLIES 5
v-rzhou-msft
Community Support
Community Support

Hola @DataNewbie

¿Podría decirme si su problema ha sido resuelto? Si es así, acédi es la solución. Más gente se beneficiará de ello. O todavía está confundido al respecto, por favor proporcione más detalles sobre su problema o compártame con su archivo pbix de su Onedrive for Business.

Saludos

Rico Zhou

v-rzhou-msft
Community Support
Community Support

Hola @DataNewbie

Al igual que Ashish_Mathur respuesta, podemos usar todas las funciones para lograr su objetivo.

Construyo una tabla como se muestra a continuación para hacerme una prueba.

1.png

Cree una segmentación de datos, un objeto visual de tabla y un objeto visual de columna Cluster.

Luego caluculamos el cagr por medida.

Cagr =

VAR _BeginningValue =

    CALCULATE (

        SUM ( 'Table'[Revenue] ),

        FILTER (

            ALL ( 'Table' ),

            'Table'[year] = MINX ( ALL ( 'Table' ), 'Table'[year] )

        )

    )

VAR _EndingValue =

    CALCULATE (

        SUM ( 'Table'[Revenue] ),

        FILTER (

            ALL ( 'Table' ),

            'Table'[year] = MAXX ( ALL ( 'Table' ), 'Table'[year] )

        )

    )

VAR _ofYears =

    DATEDIFF (

        MINX ( ALL ( 'Table' ), 'Table'[year] ),

        MAXX ( ALL ( 'Table' ), 'Table'[year] ),

        YEAR

    )

RETURN

    IFERROR ( ( _EndingValue / _BeginningValue ) ^ ( 1 / ( _ofYears - 1 ) ), 0 )

Resultado:

2.png

Seleccionar 2018

3.png

Nuestra medida ganadat cambiar por la cortadora.

Puede descargar el archivo pbix desde este enlace: Calcular CAGR de varios años mientras ignora el filtro de segmentación de datos para la fecha

Saludos

Rico Zhou

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Anonymous
Not applicable

Hola @RicoZhou - su solución funciona perfectamente en el nivel general! Sin embargo, cuando dejo caer la medida CAGR en una tabla, no se actualiza en función de los catregories en cada fila. Ejemplo: Tengo industrias en la primera columna, cada fila es una industria diferente. Me gustaría ajustar su fórmula para proporcionar el CAGR para cada industria en la fila de la tabla. ¿Puede proporcionar orientación?

Gracias

Hola @DataNewbie

Construyo una nueva mesa para hacerme una prueba.

Industry_Revenue Tabla:

1.png

Luego construyo una nueva medida:

Cagr_Industry = 
VAR _BeginningValue =
    CALCULATE (
        SUM ( 'Industry_Revenue'[Revenue] ),
        FILTER (
            ALL ( 'Industry_Revenue' ),
            'Industry_Revenue'[year]
                = MINX ( ALL ( 'Industry_Revenue' ), 'Industry_Revenue'[year] )
                && Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        )
    )
VAR _EndingValue =
    CALCULATE (
        SUM ( 'Industry_Revenue'[Revenue] ),
        FILTER (
            ALL ( 'Industry_Revenue' ),
            'Industry_Revenue'[year]
                = MAXX ( ALL ( 'Industry_Revenue' ), 'Industry_Revenue'[year] )
                && Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        )
    )
VAR _MinYear =
    MINX (
        FILTER (
            ALL ( 'Industry_Revenue' ),
            Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        ),
        'Industry_Revenue'[year]
    )
VAR _MaxYear =
    MAXX (
        FILTER (
            ALL ( 'Industry_Revenue' ),
            Industry_Revenue[Industry] = MAX ( Industry_Revenue[Industry] )
        ),
        'Industry_Revenue'[year]
    )
VAR _ofYears =
    DATEDIFF ( _MinYear, _MaxYear, YEAR )
RETURN
    IFERROR ( ( _EndingValue / _BeginningValue ) ^ ( 1 / ( _ofYears - 1 ) ), 0 )

Resultado:

Predeterminado:

2.png

Seleccione 2018 en Slicer:

3.png

Puede descargar el archivo pbix desde este enlace: Calcular CAGR de varios años mientras ignora el filtro de segmentación de datos para la fecha

Saludos

Rico Zhou

Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Ashish_Mathur
Super User
Super User

Hola

¿Funciona?

CALCULATE(SUM(table[revenue]),FILTER(ALL(table),table[year]-MIN(table[year])))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.