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

¿Cómo encontrar el valor máximo solo para el último 1 año?

Así que tengo una tabla con datos que abarcan 10 años. Sin embargo, me gustaría encontrar el valor más alto sólo para el último 1 año. Intenté usar MAX() pero entiende que devuelve valores de todo el lapso de 10 años, que no es lo que estoy buscando.

6 REPLIES 6
amitchandak
Super User
Super User

@dragonus , ¿tienes fecha?

Con fecha

Ventas YTD á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
O

Rolling 12 á CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 á CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-12,MONTH))

Con sólo un año

Este año: CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year]))) // Date can be year table only

@amitchandak

Probé tu última fórmula

Este año: CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year]))) // Date can be year table only

Sin embargo, me devolvió el último valor para cada fila en lugar del valor más grande del último 1 año.

@dragonus ,¿Puede compartir datos de ejemplo y salida de ejemplo en formato de tabla?

Actualmente tengo esto:

Measure: calculate(sum(table[value]),filter('table','table'[value] á max ('table'[value])))

Lo que me da el valor más alto para toda la tabla

Sin embargo, me gustaría obtener el valor más alto para el año pasado.

También he intentado

Measure: calculate(sum(table[value]),filter('table','table'[value] á max ('table'[value])),filter('table','table'[date].[ año] á max('table'[fecha].[ año])))

Lo que me dio valores que necesitan para cumplir con los requisitos de ser tanto el más grande y existente en el año. Por lo tanto, devuelve espacios en blanco si los valores más grandes no existen en el año pasado.

Sin embargo, necesito valores en el último año que sea el más grande.

@dragonus

Pruebe esta medida, toma un año a partir de la fecha de hoy y devuelve los valores más altos.

Max Value = 
VAR PAST1YR = EDATE(TODAY(),-12)

RETURN
MAXX(
    FILTER(
        DATA,
        DATA[Date] >= PAST1YR && DATA[Date] <= TODAY()
    ),
    DATA[Value]
)
  

________________________

¿He respondido a tu pregunta? Marque este post como una solución, esto ayudará a otros!.

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

YoutubeLinkedin

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

Seguro

FechaCategoríaValor
01/02/2019A2039
02/02/2019A2948
01/02/2020A1233
01/02/2020A1211

Salida de muestra

CategoríaValor máximo del año pasado
A1233

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.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

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