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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
chiyow2828
Frequent Visitor

How to Compute Values if one lot ID has multiple values

Hi, 

I am trying to get the total quantity of a table but the data itself has multiple duplicates. 

On top of that, there is no distinct identifier as 1 lot ID has 2 values. 

When i try to use distinct and sumx function, I get error that a single value for column "QTY" cannot be determined. 

See example data below. 

LotIDDateMonthYearQTYMFGSite
6380625.1Friday September 15202338461A
6380625.1Friday September 1520236419A
6380625.1Friday September 15202338461A
6380625.1Friday September 1520236419A
6390627.2Wednesday September 13202359800B
6390627.2Wednesday September 13202359800B
6390627.2Wednesday September 13202359800B
6390141.2Wednesday September 13202310000B
6390141.2Wednesday September 13202310000B
6390141.2Wednesday September 13202310000B
6390141.2Wednesday September 13202310000B
6390627.2Friday September 15202350000B
6390627.2Friday September 15202350000B
6390627.2Friday September 15202350000B
6390186.2Thursday September 1420232959B
6390186.2Thursday September 1420232959B
6390186.2Thursday September 1420232959B
6390186.2Thursday September 1420232959B
6394728.1Thursday September 1420235421B
6394728.1Thursday September 1420235421B
6394728.1Thursday September 1420235421B
6394728.1Wednesday September 13202350000B
6394728.1Wednesday September 13202350000B
6394728.1Wednesday September 13202350000B

 

Since 1 distinct lot ID has 2 values, I tried to concatenate the lot ID and quantity so that I can get 1 distinct lot ID+Qty. 

 

ConcatenateLot IDValues
6380625.1384616380625.138461
6380625.164196380625.16419
6390627.2598006390627.259800
6390141.2100006390141.210000
6390627.2500006390627.250000
6390186.229596390186.22959
6394728.154216390186.25421
6394728.1500006394728.150000

 Manually cleaning this up in excel, I should be getting the total value of 223060. 

How can I do it in power BI via. Would like to know how to use the distinct and sumx syntax for these case. 

 

1 REPLY 1
ERD
Community Champion
Community Champion

Hi. You can solve the issue in Power Query. Just select all columns and click Remove Duplicates:

ERD_0-1695229888543.png

 

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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