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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gunjan80
Employee
Employee

Calcular y filtrar no dando resultados correctos

En la siguiente tabla para cada mes, cada cliente tiene un tamaño particular. Quiero obtener el tamaño del último mes (es decir, mayo) para cada cliente. Planeo cortar los datos por los clientes. La siguiente medida dax proporciona valores incorrectos.

calculate(max(tablename[Size]), Filter(Filter(tablename, not(isblank(tablename[Size]))), lastdate(tablename(date))))

Nombre del cliente

Tamaño

Fecha

Cantidad de artículos

6/1/2020

6/1/2020

6/1/2020

6/1/2020

6/1/2020

customer1

Grande

5/1/2020

10

customer2

Pequeño

5/1/2020

20

customer3

Medio

5/1/2020

20

customer4

Medio

5/1/2020

30

customer5

Grande

5/1/2020

30

customer6

Grande

5/1/2020

50

customer1

Pequeño

4/1/2020

40

customer2

Pequeño

4/1/2020

15

customer3

Medio

4/1/2020

60

customer4

Medio

4/1/2020

25

customer5

Medio

4/1/2020

45

customer6

Pequeño

4/1/2020

35

2 REPLIES 2
amitchandak
Super User
Super User

@gunjan80, con tabla de fechas e inteligencia de tiempo que debe ser capaz de obtener

last MTD (complete)  =  CALCULATE(max(tablename[Size]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
or
last month =  CALCULATE(max(tablename[Size]),previousmonth('Date'[Date],-1,MONTH))

Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únase a ella con la columna de fecha de su/s hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Apreciamos tus Felicitaciones.

Gracias. Pero mis datos en algún momento tienen filas en blanco para los últimos dos meses, a veces durante 1 mes y a veces no hay filas en blanco. Depende de cuándo se actualiza el informe. por lo que la inteligencia del tiempo puede no funcionar.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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