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

Group by, Removing Duplicates, and Adding Rows

Hi! 

I am looking for help with removing duplicates when grouping, and adding a column. Or however, I can achieve the second table (i just started off with group-by and summing but that did not work because to double counts my rows). 

Here is an example: 

Key IDGross SalesExempt SalesNonTaxed SalesAmount Subject to TaxSales TaxRate

00001

100.00

00100.006.006%
00001100.0000100.001.001%
00001100.0000100.000.500.5%
00001100.0000100.002.002%
0000250.00050.00000
0000220.000020.0010.0050%
0000375.0075.0000

0

0
0000430.000

30.00

000
0000410.000010.001.0010%
0000430.00030.00000
0000410.000010.002.0020%

Above we have instances where I there are duplicates in several columns. However, the driving factors are the Gross Sales and the Rate, along with the transaction ID. However, since there are different sales taxes depending on jurisdiction, the rows repeat for the transaction (even though they are blank since the exempt and non-taxable amount drive the rate (if there is something in this column then the rate is 0). 

 

This is what I would like the column to look like. 

Key IDGross SalesExempt SalesNonTaxed SalesAmount Subject to TaxSales TaxRate

00001

100.00

00100.009.507.5%
0000270.00050.0020.0010.0050%
0000375.0075.0000

0

0
0000440.000

30.00

10.003.0030%

I would like one row per key. If the values in each colum (per key) I would like them to be added, other wise they will be double counted and that is incorrect. So if the values are different, I would like them to be added. 

 

Thank you! 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@pbiwizard You don't need to create a new table, just add measure for each column and then use that in the visual, here is the example of the measure for Gross Sales

 

Gross Sales M = 
SUMX ( 
    SUMMARIZE ( TableSum, TableSum[Key ID], TableSum[Gross Sales] ), 
    [Gross Sales] 
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

1 REPLY 1
parry2k
Super User
Super User

@pbiwizard You don't need to create a new table, just add measure for each column and then use that in the visual, here is the example of the measure for Gross Sales

 

Gross Sales M = 
SUMX ( 
    SUMMARIZE ( TableSum, TableSum[Key ID], TableSum[Gross Sales] ), 
    [Gross Sales] 
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.

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.