Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext 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
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.
@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
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
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 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Seguro
| Fecha | Categoría | Valor |
| 01/02/2019 | A | 2039 |
| 02/02/2019 | A | 2948 |
| 01/02/2020 | A | 1233 |
| 01/02/2020 | A | 1211 |
Salida de muestra
| Categoría | Valor máximo del año pasado |
| A | 1233 |
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.