Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hola a todos,
Me gustaría crear una medida usando dax para obtener la fecha máxima para cada identificación y fecha filtrada, y mantener cada fecha en mi tabla.
| fecha | identificación | Fecha máxima |
| 01/01/2022 | A | 01/03/2022 |
| 01/02/2022 | A | 01/03/2022 |
| 01/03/2022 | A | 01/03/2022 |
| 01/01/2022 | B | 01/03/2022 |
| 01/02/2022 | B | 01/03/2022 |
| 01/03/2022 | B | 01/03/2022 |
| 01/01/2022 | C | 01/02/2022 |
| 01/02/2022 | C | 01/02/2022 |
| 01/01/2022 | D | 01/03/2022 |
| 01/03/2022 | D | 01/03/2022 |
| fecha | identificación | Fecha máxima |
| 01/01/2022 | A | 01/02/2022 |
| 01/02/2022 | A | 01/02/2022 |
| 01/01/2022 | B | 01/02/2022 |
| 01/02/2022 | B | 01/02/2022 |
| 01/01/2022 | C | 01/02/2022 |
| 01/02/2022 | C | 01/02/2022 |
| 01/01/2022 | D | 01/01/2022 |
Dos ejemplos de tablas que me gustaría (son iguales, el segundo está filtrado).
Probé múltiples fórmulas, tales como:
Hi !
@Pierre_B
Use this one
Measure=Calculate(max(Date),Allexcept(Tablename,IDColumn))
Gracias
Thennarasu R
Como respondió a @Barthel, no tiene en cuenta el filtro en 'Fecha'.
Thank you for your response. I am not getting what is expected, as I would like to have the max date of the selected dates. So I need to keep the filter on 'Date'.
In my example (2), I filtered 'Date' to keep Jan & Feb and the 'max date' showed Feb as max date for ID A, B, C and Jan for D.
With ALLEXCEPT, I get the max date among all 'Date'.
Let me know if you have any ideas.
Esto es lo que intenté pero recibo este mensaje:
"La expresión se refiere a varias columnas. Varias columnas no se pueden convertir en un valor escalar".
Siempre es lo que obtengo cuando combino el filtro en fechas seleccionadas e IDs ...
Intente usar una variable. Para mí eso parece hacer el truco.
max date =
VAR _dates =
ALLSELECTED ( 'Table'[date] )
VAR _result =
CALCULATE (
MAX ( 'table'[date] ),
REMOVEFILTERS ( 'Table' ),
VALUES ( 'Table'[id] ),
_dates
)
RETURN
_result
Gracias por su respuesta. No estoy obteniendo lo que se espera, ya que me gustaría tener la fecha máxima de las fechas seleccionadas. Así que necesito mantener el filtro en 'Fecha'.
En mi ejemplo (2), filtré 'Fecha' para mantener Jan y Feb y la 'fecha máxima' mostró febrero como fecha máxima para ID A, B, C y Jan para D.
Con ALLEXCEPT, obtengo la fecha máxima entre todas las 'Fechas'.
Avísame si tienes alguna idea.
Oh, sí, entiendo lo que quieres decir. Puede hacer que el cálculo tenga en cuenta las fechas seleccionadas utilizando la fórmula ALLSELECTED. Esto quita el contexto de filtro desde dentro del objeto visual (las filas de la matriz) y mantiene el contexto de filtro desde fuera del objeto visual (por ejemplo, una segmentación de datos).
max date =
CALCULATE (
MAX ( 'table'[date] ),
ALLEXCEPT ( 'table', 'table'[id] ),
ALLSELECTED ( 'table'[date] )
)
¿Funciona esto?
Hola @Pierre_B,
Pruébalo:
max date =
CALCULATE (
MAX ( 'table'[date] ),
ALLEXCEPT ( 'table', 'table'[id] )
)Calcula la fecha máxima para cada fila eliminando todo el contexto más fiel de la tabla, excepto el del 'id', de modo que la fecha máxima se calcula por 'id'.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!