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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
nsbars_rt
Advocate I
Advocate I

Agrupación con condición

Hola

Por favor, aconséjelo. Situación simple, pero me quedé atascado.

Tengo una mesa que se ve así:

s1.jpg

Necesito agruparlo por nombre, tomar min(OnDate)

y (aquí está la pregunta) tomar el Departamento que era cuando la fecha - min(OnDate)

Si me gusta:

testTable - RESUMIR('Tabla';' Tabla'[Nombre];" minDate";min('Table'[OnDate]);" minDept";min('Table'[Department]))
Entiendo
Departamento de Abarrotes en la agrupación
que no es lo que quiero.
2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hola @nsbars_rt ,

Puede intentar crear una nueva columna calculada mediante la instrucción if.

Column = 
VAR min_date = CALCULATE(MIN('TABLE'[ondate]),ALLEXCEPT('TABLE','TABLE'[name]))
return IF('TABLE'[ondate]=min_date,1)

Puede filtrar en el gráfico de tablas o crear una nueva tabla calculada.

test_min_date.PNG

Table 2 = SELECTCOLUMNS(FILTER('TABLE','TABLE'[Column]=1),"name",'TABLE'[name],"ondate",'TABLE'[ondate],"department",'TABLE'[department])

test_min_date_2.PNG

Saludos
Liang
Si este post ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

amitchandak
Super User
Super User

@nsbars_rt, Pruebe lastnonblankvalue

https://docs.microsoft.com/en-us/dax/lastnonblankvalue-function-dax

lastnonblankvalue(Table[date],min(table[Department]))

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.