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

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

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

@SKH19 ,

tratar como

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

View solution in original post

4 REPLIES 4
neha369
Helper I
Helper I

También puede probar

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

@SKH19 ,

tratar como

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

Anonymous
Not applicable

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

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.

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.