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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LT_Maverick
Frequent Visitor

Excel - Data Cleaning for Analysis - Remove Duplicate Numerical Values in a single cell

Date of ServicePatient Case Number (Unique Value)CPT CodeHCPS Code
1/1/202390008143239
43247
96361
96361
96374
96375
96375
99283
43239
2/1/202490008238510
88341
88341
88341
88341
88341
88342
38510
3/1/20249008345385
45380
43239
88305
88305
88305
88305
88305
88305
45385

 

I am cleaning up some data to figure out what our procedural volume by CPT code is. However, I need to remove any duplicates in the "CPT" column. After that I am not sure how to use it as a unique value to calculate volume by date (month, year, fiscal year). 

 

I plan to put the volumes in a column graph similar to the one below. I plan to use a "filter" to select different CPT codes. 

 

Screenshot 2025-04-29 164516.png

2 ACCEPTED SOLUTIONS
Irwan
Super User
Super User

hello @LT_Maverick 

 

please check if this accomodate your need.

Irwan_0-1745969304367.png

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("vZBLCoAwDETv0rXgNEltepbi/a9h/LS1utCFCIWZPGh4JGcHP9ojELvBJQDqrQgTp5rzkJ0N+yxxrQ2liSf/BkW5o/CMEikXBDpkpciSFdbgUbN9VWW5aHyNqJpxb7Y5SzClmqcr2ox+WTl4vx/hDzQv", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date of Service" = _t, #"Patient Case Number (Unique Value)" = _t, #"CPT Code" = _t, #"HCPS Code" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date of Service", type date}, {"Patient Case Number (Unique Value)", Int64.Type}, {"CPT Code", Int64.Type}, {"HCPS Code", Int64.Type}}),
#"Filled Down" = Table.FillDown(#"Changed Type",{"Date of Service", "Patient Case Number (Unique Value)", "HCPS Code"}),
#"Removed Duplicates" = Table.Distinct(#"Filled Down", {"CPT Code"})
in
#"Removed Duplicates"

 

since you are using merge cell in excel, those merge cell will be blank valu so you need to fill down those blank value.

Irwan_1-1745969451505.png

 

after that, just remove duplicate on what column you want to be removed.

Irwan_2-1745969503736.png

 

the other way is using DISTINCT or DISTINCTCOUNT in your DAX, then it will only count a unique value.

 

Hope this will help.

Thank you.

View solution in original post

v-sathmakuri
Community Support
Community Support

Hi @LT_Maverick ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

 

Thank you!!

View solution in original post

4 REPLIES 4
v-sathmakuri
Community Support
Community Support

Hi @LT_Maverick ,

 

I hope this information provided is helpful. Feel free to reach out if you have any further questions or would like to discuss this in more detail. If responses provided answers your question, please accept it as a solution so other community members with similar problems can find a solution faster.

 

Thank you!!

v-sathmakuri
Community Support
Community Support

Hi @LT_Maverick ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

 

Thank you!!

v-sathmakuri
Community Support
Community Support

Hi @LT_Maverick ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you!!

Irwan
Super User
Super User

hello @LT_Maverick 

 

please check if this accomodate your need.

Irwan_0-1745969304367.png

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("vZBLCoAwDETv0rXgNEltepbi/a9h/LS1utCFCIWZPGh4JGcHP9ojELvBJQDqrQgTp5rzkJ0N+yxxrQ2liSf/BkW5o/CMEikXBDpkpciSFdbgUbN9VWW5aHyNqJpxb7Y5SzClmqcr2ox+WTl4vx/hDzQv", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date of Service" = _t, #"Patient Case Number (Unique Value)" = _t, #"CPT Code" = _t, #"HCPS Code" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date of Service", type date}, {"Patient Case Number (Unique Value)", Int64.Type}, {"CPT Code", Int64.Type}, {"HCPS Code", Int64.Type}}),
#"Filled Down" = Table.FillDown(#"Changed Type",{"Date of Service", "Patient Case Number (Unique Value)", "HCPS Code"}),
#"Removed Duplicates" = Table.Distinct(#"Filled Down", {"CPT Code"})
in
#"Removed Duplicates"

 

since you are using merge cell in excel, those merge cell will be blank valu so you need to fill down those blank value.

Irwan_1-1745969451505.png

 

after that, just remove duplicate on what column you want to be removed.

Irwan_2-1745969503736.png

 

the other way is using DISTINCT or DISTINCTCOUNT in your DAX, then it will only count a unique value.

 

Hope this will help.

Thank you.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

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.