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
Manuu_108
Frequent Visitor

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=11185...
aa1.jpgFB6.jpg

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community 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])

vjingzhang_0-1675928890762.png

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"
)

vjingzhang_2-1675930056864.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community 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])

vjingzhang_0-1675928890762.png

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"
)

vjingzhang_2-1675930056864.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

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.

Top Solution Authors