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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PwrBI01
Post Patron
Post Patron

Remove duplicates getting the last date and doing a sum of another ones

Hi guys, 

 

I have the next table in Power BI:

 

Imagen5.png

 

I want to create a new table removing duplicates in the column 'IDEXPEDIENTE' with the next characteristics:

 

Column 'FECHAFACTURA'. Put the last date of the duplicates values

Column 'TOTALBRUTO'. Calculate the sum of 'TOTALBRUTO' values that have the same 'IDEXPEDIENTE'

Column 'TIPOIVA'. Put the number of the last date

Column 'CUOTAIVA'. Calculate the sum of 'CUOTAIVA' values that have the same 'IDEXPEDIENTE'

Column 'TOTALFACTURA'. Calculate the sum of 'TOTALFACTURA' values that have the same 'IDEXPEDIENTE'

Column 'IDFACTURACION'. Put the value of the last date

 

I should obtain a table similar to the next one:

 

Imagen6.png

 

Thanks in advance.

 

Regards.

 

1 ACCEPTED SOLUTION
mhossain
Solution Sage
Solution Sage

Hello @PwrBI01 

 

Assuming your table name is "Table", try below dax to create new table.

1). Dax method

Go to Table tool and create DAX table, and use below DAX

mhossain_0-1611329081368.png

Table 2 = SUMMARIZE('Table',
'Table'[IDEXPEDIENTE],
"FECHAFACTURA",LASTDATE('Table'[FECHAFACTURA]),
"TOTALBRUTO",SUM('Table'[TOTALBRUTO]),
"TIPOIVA",LASTNONBLANKVALUE('Table'[TIPOIVA],VALUES('Table'[TIPOIVA])),
"CUOTAIVA",SUM('Table'[CUOTAIVA]),
"TOTALFACTURA",SUM('Table'[TOTALFACTURA]),
"IDFACTURACION",LASTNONBLANKVALUE('Table'[IDFACTURACION],VALUES('Table'[IDFACTURACION]))

)

 

2).

 

In PowerQuery you can create this easily using Group BY.

 

Please let me know if this solves and this is what you were looking for.

View solution in original post

2 REPLIES 2
mhossain
Solution Sage
Solution Sage

Hello @PwrBI01 

 

Assuming your table name is "Table", try below dax to create new table.

1). Dax method

Go to Table tool and create DAX table, and use below DAX

mhossain_0-1611329081368.png

Table 2 = SUMMARIZE('Table',
'Table'[IDEXPEDIENTE],
"FECHAFACTURA",LASTDATE('Table'[FECHAFACTURA]),
"TOTALBRUTO",SUM('Table'[TOTALBRUTO]),
"TIPOIVA",LASTNONBLANKVALUE('Table'[TIPOIVA],VALUES('Table'[TIPOIVA])),
"CUOTAIVA",SUM('Table'[CUOTAIVA]),
"TOTALFACTURA",SUM('Table'[TOTALFACTURA]),
"IDFACTURACION",LASTNONBLANKVALUE('Table'[IDFACTURACION],VALUES('Table'[IDFACTURACION]))

)

 

2).

 

In PowerQuery you can create this easily using Group BY.

 

Please let me know if this solves and this is what you were looking for.

Thank you very much, option 1 is just what I need.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors