Reply
avatar user
Anonymous
Not applicable
Syndicated - Inbound

Medida DAX para el valor máximo basado en el año

Source Community: Power BI

Hola

Tengo un conjunto de datos que tiene valores y el año en que se registró ese valor. Quiero crear una medida que muestre el valor máximo para ese año cuando lo agreda a una tabla. Por ejemplo, mis datos tienen este aspecto:

añoValor
20081
20083
20081
20094
20103
20105
20101
20113
20112
20121

Así que la medida que quiero agregaría una columna a la tabla que se ve así:

añoValormáximo
200813
200833
200813
200944
201035
201055
201015
201133
201123
201211

Lo intenté:

Medida: CALCULATE(MAX('Tabla'[Valor]))
pero solo devuelve el número de la columna Valor.
También necesito hacer lo mismo para Min, pero me imagino que será el mismo DAX sólo con MIN en lugar de MAX.
Gracias
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Source Community: Power BI
Syndicated - Inbound

@SKH19 ,

tratar como

Medida: CALCULATE(MAX('Table'[Value]),allexcept('Table'[Year]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
neha369
Helper I
Helper I

Source Community: Power BI
Syndicated - Inbound

También puede probar

Columna: CALCULATE(MAX('Table'[Value]),GROUPBY('Table','Table'[Value]))
amitchandak
Super User
Super User

Source Community: Power BI
Syndicated - Inbound

@SKH19 ,

tratar como

Medida: CALCULATE(MAX('Table'[Value]),allexcept('Table'[Year]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
avatar user
Anonymous
Not applicable

Source Community: Power BI
Syndicated - Inbound

Gracias, eso funciona.

¿Qué pasa si quiero el promedio de cada año?

añoValorPromedio
20081

1.66

200831.66
200811.66
200944
201033
201053
201013
201132.5
201122.5
201211

Source Community: Power BI
Syndicated - Inbound

HOLA @SKH19,

Puede probar la siguiente fórmula de medida si funciona:

Measure =
CALCULATE (
    AVERAGE ( table[Value] ),
    ALLSELECTED ( table ),
    VALUES ( table[Year] )
)

Puede cambiar las funciones de agregado para aplicar un modo de resumen diferente en los campos. (min, máx., suma, media...)

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)