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

Calcular la diferencia de medida entre la categoría frente al cambio total general a lo largo del tiempo (.pbix adjunto)

Tengo una medida que calcula el % de otras dos columnas (es Carga como % de ventas). Quiero calcular cómo esto ha cambiado con el tiempo y la diferencia de las categorías frente al total general de un período anterior. No tengo claro cómo hacerlo.

He adjuntado un conjunto de datos de ejemplo, así como una imagen a continuación de lo que estoy tratando de hacer.

Ejemplo

La categoría A es del 1,2% en 2020

El Gran Total en 2019 fue del 0,38%

La diferencia entre la Categoría A en 2020 frente al Total General es de 0.35% - 1.20% - -0.85%.

¿Cómo calculo esta diferencia?

Ejemplo de datos en PowerBI: https://1drv.ms/u/s!AvCirXUmRp-JhbY86LW-Vr-skR6XPw?e=AmqJYb

example change.png

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Por favor, pruebe esta expresión para obtener el resultado deseado.

NewMeasure =
VAR thisyear =
    MIN ( DateTable[Year] )
VAR freightpctsalesminus = [Freight % of Sales minus % Change Difference]
VAR PYtotal =
    CALCULATE (
        [Freight % of Sales],
        ALL ( 'Table'[Category] ),
        ALL ( DateTable ),
        VALUES ( DateTable[Quarter] ),
        DateTable[Year] = thisyear - 1
    )
RETURN
    PYtotal - freightpctsalesminus

Si esto funciona para usted, márquelo como la solución. Los elogios también son apreciados. Por favor, avísame si no.

saludos

palmadita





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hola @jcueland ,

Consulte la siguiente medida:

Measure =
VAR lastyear =
    CALCULATE (
        [Freight % of Sales],
        ALL ( 'Table'[Category] ),
        SAMEPERIODLASTYEAR ( DateTable[Date] )
    )
RETURN
    lastyear - [Freight % of Sales minus % Change Difference]

Capture.PNG

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

Saludos

Dedmon Dai

mahoneypat
Employee
Employee

Por favor, pruebe esta expresión para obtener el resultado deseado.

NewMeasure =
VAR thisyear =
    MIN ( DateTable[Year] )
VAR freightpctsalesminus = [Freight % of Sales minus % Change Difference]
VAR PYtotal =
    CALCULATE (
        [Freight % of Sales],
        ALL ( 'Table'[Category] ),
        ALL ( DateTable ),
        VALUES ( DateTable[Quarter] ),
        DateTable[Year] = thisyear - 1
    )
RETURN
    PYtotal - freightpctsalesminus

Si esto funciona para usted, márquelo como la solución. Los elogios también son apreciados. Por favor, avísame si no.

saludos

palmadita





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.