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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Scarthart
Helper I
Helper I

Create a separate table from another with unique values ​​and a total column


good morning, I hope you can help me, I want to create a table from another, what I want is for the new table to take the unique values ​​with the total amountCaptura de pantalla 2022-11-30 102616.pngCaptura de pantalla 2022-11-30 102644.png

 

These are the two columns in which I want to generate the new table with unique values

 

Captura de pantalla 2022-11-30 102846.png

1 ACCEPTED SOLUTION

En ese caso usa el código DAX equivalente a:

Tabla cantidad por código =
ADDCOLUMNS (
    SUMMARIZE ( fTable, fTable[Código], fTable[Descripción] ),
    "Cantidad",
        CALCULATE (
            SUM ( fTable[Cantidad] ),
            FILTER ( fTable, fTable[Código] = EARLIER ( fTable[Código] ) )
        )
)

ftable.jpgnew.jpgresult.jpg

 

Pero si lo que necesitas es visualizar las cantidades, lo único que necesitas es crear una medida tipo :

Suma de Cantidad = SUM(fTable[Cantidad])

y creas un visual de tabla con los campos originales de código y descripción & la medida:

visual.jpg

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
PaulDBrown
Community Champion
Community Champion

Try this pattern:

 

Tabla cantidad por código =
ADDCOLUMNS (
    VALUES ( fTable[Código] ),
    "Cantidad",
        CALCULATE (
            SUM ( fTable[Cantidad] ),
            FILTER ( fTable, fTable[Código] = EARLIER ( fTable[Código] ) )
        )
)

 

ftable.jpgnew.jpgresult.jpg


However, is there a particular reason you  need to create these new physical tables? These sort of operations are normally done using measures in visuals





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown Thank you very much seriously, the reason why I am discovering this table is because I want to know the total quantity of the product, in this almost the product is identified by a code.

 

In the case that you want to add a description, how can you add it?

 

Captura de pantalla 2022-11-30 113607.png

En ese caso usa el código DAX equivalente a:

Tabla cantidad por código =
ADDCOLUMNS (
    SUMMARIZE ( fTable, fTable[Código], fTable[Descripción] ),
    "Cantidad",
        CALCULATE (
            SUM ( fTable[Cantidad] ),
            FILTER ( fTable, fTable[Código] = EARLIER ( fTable[Código] ) )
        )
)

ftable.jpgnew.jpgresult.jpg

 

Pero si lo que necesitas es visualizar las cantidades, lo único que necesitas es crear una medida tipo :

Suma de Cantidad = SUM(fTable[Cantidad])

y creas un visual de tabla con los campos originales de código y descripción & la medida:

visual.jpg

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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