Forum Discussion
REGISTRO DE PRODUCTOS PRESTADOS Y DEVUELTOS
Buenas Noches recurro a su conocimiento para el siguiente reto.
Tengo una tabla donde se registra todos los productos prestados y que tienen que ser devueltas, las celdas marcadas con rojo, azul y verde que corresponde a Ana Maria, Daniela y Mariela quienes se prestaron y devolvieron, por lo tanto no figuran en el reporte filtrado.
En el caso de Sofia ( marcado con amarillo) hubo 3 ocurrencias en un mismo dia:
1.- Se prestó el producto P301 a hrs: 11:30 am
2.- Se devolvio el producto P301 a hrs: 14:40 pm
3.- y por ultimo, se prestó nuevamente el mismo producto a hrs: 17:55 pm
Por lo cual en el resporte debe mostrar la ÚLTIMA OCURRENCIA en este caso, Sofia queda pendiente de devolucion del producto P301.
(Envio archivo de ejemplo)
https://docs.google.com/spreadsheets/d/1AHtJl03i65wdRILZ69BG2MP2FBdf4vc6/edit?usp=sharing&ouid=111859257495716223600&rtpof=true&sd=true
Hi Manuu_108
Here is my solution:
First add a calculated column to the original table with below DAX. This is to get the product name on each row.
Producto = MAX('Table'[Producto Entregado],'Table'[Producto Devuelto])Then create a calculated table with below DAX to get the expected result with data from the original table. The sample file has been attached at bottom.
Table 2 = SELECTCOLUMNS ( FILTER ( SUMMARIZE ( 'Table', 'Table'[Nombre], 'Table'[Producto], "count_of_entregado", CALCULATE ( COUNT ( 'Table'[Producto Entregado] ), 'Table'[Producto Entregado] <> BLANK () ), "count_of_devuelto", CALCULATE ( COUNT ( 'Table'[Producto Devuelto] ), 'Table'[Producto Devuelto] <> BLANK () ), "Fecha Prestada", MAX ( 'Table'[Fecha] ) ), [count_of_entregado] > [count_of_devuelto] ), "Fecha Prestada", [Fecha Prestada], "Name", [Nombre], "Situacion", "Con Observacion", "Producto Prestado", [Producto], "Dias Prestados", INT ( TODAY() - [Fecha Prestada] ) & " Dias" )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
1 Reply
- v-jingzhangCommunity Support
Hi Manuu_108
Here is my solution:
First add a calculated column to the original table with below DAX. This is to get the product name on each row.
Producto = MAX('Table'[Producto Entregado],'Table'[Producto Devuelto])Then create a calculated table with below DAX to get the expected result with data from the original table. The sample file has been attached at bottom.
Table 2 = SELECTCOLUMNS ( FILTER ( SUMMARIZE ( 'Table', 'Table'[Nombre], 'Table'[Producto], "count_of_entregado", CALCULATE ( COUNT ( 'Table'[Producto Entregado] ), 'Table'[Producto Entregado] <> BLANK () ), "count_of_devuelto", CALCULATE ( COUNT ( 'Table'[Producto Devuelto] ), 'Table'[Producto Devuelto] <> BLANK () ), "Fecha Prestada", MAX ( 'Table'[Fecha] ) ), [count_of_entregado] > [count_of_devuelto] ), "Fecha Prestada", [Fecha Prestada], "Name", [Nombre], "Situacion", "Con Observacion", "Producto Prestado", [Producto], "Dias Prestados", INT ( TODAY() - [Fecha Prestada] ) & " Dias" )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.