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
shei7141
Helper III
Helper III

maxifs de una medida

Hola a todos

Tengo una mesa que se parece a esta:

No de proyecto (columna)Fases (columna)EstCost (soy una medida)
1suyos10
1Opción 115
1Opción 211
1Opción315
1Ps20
2suyos5
2Opción 16
2Opción 24
2Opción37
2Ps1

Quiero calcular otra medida que pueda calcular el máximo del estCost para cada uno de los proyectos. Así que el resultado debería tener este aspecto:

No de proyecto (columna)Fases (columna)EstCost (soy una medida)nueva medida
1suyos1010
1Opción 11515
1Opción 211
1Opción315
1Ps2020
2suyos55
2Opción 167
2Opción 24
2Opción37
2Ps11

Cualquier puntero será muy apreciado!

Gracias

Shei

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@shei7141

Idealmente, debe agregar una columna para categorizar la columna Fase en Opción, SA, PS, etc. en la tabla de dimensiones. Pero la siguiente solución debería funcionar tal cual. Las opciones 1 y 3 son las mismas para el proyecto 1 y devuelven el mismo valor.

New Measure = 
VAR Opt =  {"Option1","Option2","Option3"} 
VAR Phs = SELECTEDVALUE(Table03[Phases])
VAR CurrCost = [Est.Cost (M)]
VAR MaxCost =  
    IF( 
        Phs in  Opt, 
        CALCULATE(
            MAXx(ALLSELECTED(Table03[Phases]),[Est.Cost (M)]),
            Table03[Phases] in  Opt
        ),
        MAXx(VALUES(Table03[Phases]),[Est.Cost (M)])
    )  
RETURN
IF( MaxCost = CurrCost , MaxCost , BLANK() )

Fowmy_0-1598784155216.png

________________________

Si mi respuesta fue útil, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
Fowmy
Super User
Super User

@shei7141

Idealmente, debe agregar una columna para categorizar la columna Fase en Opción, SA, PS, etc. en la tabla de dimensiones. Pero la siguiente solución debería funcionar tal cual. Las opciones 1 y 3 son las mismas para el proyecto 1 y devuelven el mismo valor.

New Measure = 
VAR Opt =  {"Option1","Option2","Option3"} 
VAR Phs = SELECTEDVALUE(Table03[Phases])
VAR CurrCost = [Est.Cost (M)]
VAR MaxCost =  
    IF( 
        Phs in  Opt, 
        CALCULATE(
            MAXx(ALLSELECTED(Table03[Phases]),[Est.Cost (M)]),
            Table03[Phases] in  Opt
        ),
        MAXx(VALUES(Table03[Phases]),[Est.Cost (M)])
    )  
RETURN
IF( MaxCost = CurrCost , MaxCost , BLANK() )

Fowmy_0-1598784155216.png

________________________

Si mi respuesta fue útil, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Gracias montones mate - funcionó como un encanto

daxer-almighty
Solution Sage
Solution Sage

[Max Cost] = // calc column in T
var __proj = T[Project No.]
var __phase = T[Phase]
var __option = "option"
var __optionLen = len( __option )
var __isPhaseOption =
    LEFT( __phase, __optionLen ) = __option
return
MAXX(
    FILTER(
        T,
        T[Project No.] = __proj
        &&
        IF( __isPhaseOption,
            Len(T[Phase], __optionLen) = __option,
            T[Phase] = __phase
        )
    ),
    T[EstCost]
)
pranit828
Community Champion
Community Champion

Hola @shei7141

nueva Medida: IF(CALCULATE(MAXX(table,table[EstCost]),ALLEXCEPT(table,table[Project No.],table[Phases])) - table[EstCost],

tabla[EstCost],

BLANK())





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

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.