Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@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?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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

Top Kudoed Authors