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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Sherly2zd
New Member

Dealing with duplicates in one column

Hi!

I got data similar to below example. 

I want to get the YTD cumulative sum of Credit amount, but the problem is there are duplicates of Ticket number like A0002 and A0010. One ticket number is corresponding to exact one credit amount.

I'm not able to delete duplicates as I got the data from Direct Query. I tried to create a new table using SUMMARIZE to get rows with distinct Ticket numbers, and then create a measure to calculate YTD cumulative sum. That works, but the table I created from Direct Query cannot auto update along with the data source.

How can I get the YTD cumulative sum of credit amount without changing the source data or creating a new table?

Thanks!

Ticket numberDateCredit amountSLA breached
A000111/12/202210True
A000213/1//202313Ture
A000213/1/202313False
A000320/1/202315True
A000615/2/202313True
A000912/3/202330False
A001013/3/202324True
A001013/3/202324False
A00141/4/202315False

 

The expected outcome is like below.

Ticket numberDateYTD credit
A000111/12/2022 
A000213/1//202313
A000320/1/202328
A000615/2/202341
A000912/3/202371
A001013/3/202395
A00141/4/2023110
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Sherly2zd 

You can refer to the following measure

Measure = VAR A=SUMMARIZE(ALLSELECTED('Table'),[Ticket number],'Table'[Date],'Table'[Credit amount])
RETURN SUMX(FILTER(A,YEAR([Date])=YEAR(TODAY())&&[Date]<=SELECTEDVALUE('Table'[Date])),[Credit amount])

Output

vxinruzhumsft_0-1693882181245.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Sherly2zd 

You can refer to the following measure

Measure = VAR A=SUMMARIZE(ALLSELECTED('Table'),[Ticket number],'Table'[Date],'Table'[Credit amount])
RETURN SUMX(FILTER(A,YEAR([Date])=YEAR(TODAY())&&[Date]<=SELECTEDVALUE('Table'[Date])),[Credit amount])

Output

vxinruzhumsft_0-1693882181245.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yolo,

 

Thanks a lot! It solved my problem perfectly!

非常感谢!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors