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

Disminución por código y fecha

Hola

¿Puedo preguntarle si hay una posible manera de hacer lo mismo pero para la disminución?

Si el código aparece hoy pero ya no mañana quiero que lo refleje como un negativo.

Aquí he adjuntado un ejemplo:

Capture3.PNG

Por ejemplo, el código 888890 tenía el valor 72 para el 2 de marzo, pero no tenía ningún valor el 3 de marzo Así que quiero que la medida devuelva un -72 el 3 de marzo. Un d el mismo caso para el 4 y 5 de marzo devolviendo un -125. Para que la medida ahora en lugar de darme la suma total de thos valores positivos quiero que me dé sólo la suma de los negativos.

¡Espero que esto sea posible!

Gracias de antemano.

@Ashish_Mathur

1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hola

De acuerdo con su descripción, Por favor, pruebe esta medida:

Measure = 
VAR a =
    CALCULATE (
        SUM ( 'Table'[Values] ),
        FILTER (
            ALLSELECTED ( 'Table'[Date] ),
            'Table'[Date]
                = CALCULATE (
                    MAX ( 'Table'[Date] ),
                    FILTER (
                        ALLSELECTED ( 'Table' ),
                        'Table'[Date] < MIN ( 'Table'[Date] )
                            && 'Table'[Date Code] IN DISTINCT ( 'Table'[Date Code] )
                    )
                )
        )
    )
RETURN
    IF (
        a = BLANK (),
        IF ( MAX ( 'Table'[Values] ) = BLANK (), BLANK (), 0 ),
        SUM ( 'Table'[Values] ) - a
    )

El resultado muestra:

2.PNG

Aquí está mi archivo pbix de prueba:

pbix

Espero que esto ayude.

Saludos

Giotto Zhi

View solution in original post

2 REPLIES 2
v-gizhi-msft
Community Support
Community Support

Hola

De acuerdo con su descripción, Por favor, pruebe esta medida:

Measure = 
VAR a =
    CALCULATE (
        SUM ( 'Table'[Values] ),
        FILTER (
            ALLSELECTED ( 'Table'[Date] ),
            'Table'[Date]
                = CALCULATE (
                    MAX ( 'Table'[Date] ),
                    FILTER (
                        ALLSELECTED ( 'Table' ),
                        'Table'[Date] < MIN ( 'Table'[Date] )
                            && 'Table'[Date Code] IN DISTINCT ( 'Table'[Date Code] )
                    )
                )
        )
    )
RETURN
    IF (
        a = BLANK (),
        IF ( MAX ( 'Table'[Values] ) = BLANK (), BLANK (), 0 ),
        SUM ( 'Table'[Values] ) - a
    )

El resultado muestra:

2.PNG

Aquí está mi archivo pbix de prueba:

pbix

Espero que esto ayude.

Saludos

Giotto Zhi

amitchandak
Super User
Super User

Puede compartir datos de ejemplo y salida de muestra.

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.