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
Syndicate_Admin
Administrator
Administrator

Buscar el número n superior de proyectos con respecto a otra columna y cada mes

1-La primera parte es encontrar los n proyectos superiores con los gastos más altos cada mes (se puede crear una columna que indique si el proyecto está en la parte superior n)
2-La segunda parte es encontrar qué subproyecto está gastando más en cada proyecto entre los n proyectos principales que encontramos en la primera parte (puede ser crear una columna que diga si la condición satisface o no)

| de gasto del subproyecto del proyecto Respuesta 1(n=1) Respuesta 2(n=1)

ABC 123 $2343 ene | false false

bcd 234 $1232 ene | false false

abc 234 $2000 febrero | true true

abc 234 $2100 ene | false false

cde 345 $5000 ene | true true

cde 346 $2300 ene | verdadero falso

Gracias por la ayuda chicos

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

No @g_js ,

Se sugiere crear medidas calculadas en lugar de una columna calculada. Con las medidas, podemos crear un parámetro what-if para cambiar dinámicamente el valor TopN.

Measure 1 = 
VAR TOPN_ = [TOPN Value]
VAR t1 =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Month] = MAX ( 'Table'[Month] ) ),
        [Project],
        "Sum_", SUM ( 'Table'[Spend] )
    )
VAR t2 =
    TOPN ( TOPN_, t1, [Sum_], DESC )
RETURN
    IF ( MAX ( 'Table'[Project] ) IN SUMMARIZE ( t2, [Project] ), "true", "false" )
Measure 2 = 
VAR TOPN_ = [TOPN Value]
VAR t1 =
    SUMMARIZE (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Month] = MAX ( 'Table'[Month] )
                && 'Table'[Project] = MAX ( 'Table'[Project] )
                && [Measure 1] = "true"
        ),
        [SubProject],
        "Sum_", SUM ( 'Table'[Spend] )
    )
VAR t2 =
    TOPN ( TOPN_, t1, [Sum_], DESC )
RETURN
    IF (
        MAX ( 'Table'[SubProject] ) IN SUMMARIZE ( t2, [SubProject] ),
        "true",
        "false"
    )

TOPN.PNG

Saludos

Icey

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

View solution in original post

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

No @g_js ,

Se sugiere crear medidas calculadas en lugar de una columna calculada. Con las medidas, podemos crear un parámetro what-if para cambiar dinámicamente el valor TopN.

Measure 1 = 
VAR TOPN_ = [TOPN Value]
VAR t1 =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Month] = MAX ( 'Table'[Month] ) ),
        [Project],
        "Sum_", SUM ( 'Table'[Spend] )
    )
VAR t2 =
    TOPN ( TOPN_, t1, [Sum_], DESC )
RETURN
    IF ( MAX ( 'Table'[Project] ) IN SUMMARIZE ( t2, [Project] ), "true", "false" )
Measure 2 = 
VAR TOPN_ = [TOPN Value]
VAR t1 =
    SUMMARIZE (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Month] = MAX ( 'Table'[Month] )
                && 'Table'[Project] = MAX ( 'Table'[Project] )
                && [Measure 1] = "true"
        ),
        [SubProject],
        "Sum_", SUM ( 'Table'[Spend] )
    )
VAR t2 =
    TOPN ( TOPN_, t1, [Sum_], DESC )
RETURN
    IF (
        MAX ( 'Table'[SubProject] ) IN SUMMARIZE ( t2, [SubProject] ),
        "true",
        "false"
    )

TOPN.PNG

Saludos

Icey

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

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.