cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors