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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
GabrielFz
Frequent Visitor

Combinación de filas duplicadas y agregar columna para diferentes valores

Hola

Estoy tratando de obtener filas únicas para uno de mis orígenes de datos. Los datos tienen este aspecto:

GabrielFz_3-1592912905019.png

Y me gustaría tener una mesa como esta:

GabrielFz_4-1592912929611.png

Notas:

En mis datos originales, no todos los productos tienen 2 líneas

Tengo varias columnas con este mismo propósito, así que me gustaría una solución que funcione en una base de datos más grande

Gracias de antemano (:

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hola @GabrielFz ,

Según mi prueba, la expresión @amitchandak proporcionada es un poco problemática. Por favor, modifíquelo así:

Table 2 =
VAR t =
    SELECTCOLUMNS (
        'Table',
        "Product", 'Table'[product],
        "Quantity A", IF ( 'Table'[Location] = "A", 'Table'[Quantity], BLANK () ),
        "Quantity B", IF ( 'Table'[Location] = "B", 'Table'[Quantity], BLANK () ),
        "Delivery Date A", IF ( 'Table'[Location] = "A", 'Table'[Delivery Date], BLANK () ),
        "Delivery Date B", IF ( 'Table'[Location] = "B", 'Table'[Delivery Date], BLANK () ),
        "Color", 'Table'[Color]
    )
RETURN
    SUMMARIZE (
        t,
        [product],
        [Color],
        "Quantity A", SUMX ( t, [Quantity A] ),
        "Quantity B", SUMX ( t, [Quantity B] ),
        "Delivery Date A", MAXX ( t, [Delivery Date A] ),
        "Delivery Date B", MAXX ( t, [Delivery Date B] )
    )

t1.PNGt2.PNG

Saludos

Icey

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

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hola @GabrielFz ,

Según mi prueba, la expresión @amitchandak proporcionada es un poco problemática. Por favor, modifíquelo así:

Table 2 =
VAR t =
    SELECTCOLUMNS (
        'Table',
        "Product", 'Table'[product],
        "Quantity A", IF ( 'Table'[Location] = "A", 'Table'[Quantity], BLANK () ),
        "Quantity B", IF ( 'Table'[Location] = "B", 'Table'[Quantity], BLANK () ),
        "Delivery Date A", IF ( 'Table'[Location] = "A", 'Table'[Delivery Date], BLANK () ),
        "Delivery Date B", IF ( 'Table'[Location] = "B", 'Table'[Delivery Date], BLANK () ),
        "Color", 'Table'[Color]
    )
RETURN
    SUMMARIZE (
        t,
        [product],
        [Color],
        "Quantity A", SUMX ( t, [Quantity A] ),
        "Quantity B", SUMX ( t, [Quantity B] ),
        "Delivery Date A", MAXX ( t, [Delivery Date A] ),
        "Delivery Date B", MAXX ( t, [Delivery Date B] )
    )

t1.PNGt2.PNG

Saludos

Icey

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

amitchandak
Super User
Super User

@GabrielFz, crear una nueva tabla como

 summarize(              
selectcolumns(Table,"Product", Table[product],"Quantity A",if(Table[Location] ="A",Table[Quantity],blank())
           ,"Quantity B",if(Table[Location] ="B",Table[Quantity],blank())
           ,"Delivery Date A",if(Table[Location] ="A",Table[Delivery Date],blank())
           ,"Delivery Date B",if(Table[Location] ="B",Table[Delivery Date],blank())
           ,"Color", table[Color]),[product],[Color],"Quantity A",sum([Quantity A]),"Quantity B",sum([Quantity B])
           ,"Delivery Date A",max([Delivery Date A]),"Delivery Date B",Max([Delivery Date B]))
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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.