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

Remove duplicates based on multiple criteria (2)

Hi 

I have some data that consists of duplicates. 

These duplicates needs to be removed on multiple criteria

 

I have already used the "grouped by" function to specify the multiple criterias.

But when i do this i get an error message on a small amount of cells saying this: 

Expression.Error: The number is out of range of a 32 bit integer value.
Details:
ex: 43,2

 

The whole dataset consists of decimal numbers approx within the same range, which is why i do not understand the issue on only a handfull of cells.

 

As far as i could google it may be the formula in the criteria setup which do not support decimal numbers, but i am not able to solve the puzzle myself, which is why i reach out to you guys.

 

The dataset looks like this:

Neseren_1-1726656034343.png

 

The criteria formula looks like this:

= Table.Group(#"Changed Type", {"Batchnummer", "Nedre grænse", "Øvre grænse", "Target Value"}, {{"Resultat",
(x)=> [
t0 = List.Max(List.Transform(x[Nedre grænse],Number.From)),
t1 = List.Min(List.Transform(x[Resultat], Number.From)),
t2 = List.Max(List.Transform(x[Resultat],Number.From)),
t3 = List.Max(List.Transform(x[Øvre grænse],Number.From)),
Resultat = if t2 > t0 and t1 > t0 then t1 else if t2 < t0 and t1 < t0 then t2 else if t0 = t1 then t1 else if (List.Count( {t1..t0}) + List.Count( {t1..t0})) < (List.Count({t3..t2}) + List.Count({t3..t2})) then t1 else t2
][Resultat]}})

 

Hope you guys could help me 😄

4 REPLIES 4
Neseren
Frequent Visitor

Can anyone solve this?

Still havn't got a sollution.

 

Thanks 🙂

Anonymous
Not applicable

Hi @Neseren ,

 

you can use Number.Round to ensure that the values are within a manageable range before performing operations on them

= Table.Group(#"Changed Type", {"Batchnummer", "Nedre grænse", "Øvre grænse", "Target Value"}, {{"Resultat",
(x)=> [
t0 = List.Max(List.Transform(x[Nedre grænse], each Number.Round(Number.From(_), 2))),
t1 = List.Min(List.Transform(x[Resultat], each Number.Round(Number.From(_), 2))),
t2 = List.Max(List.Transform(x[Resultat], each Number.Round(Number.From(_), 2))),
t3 = List.Max(List.Transform(x[Øvre grænse], each Number.Round(Number.From(_), 2))),
Resultat = if t2 > t0 and t1 > t0 then t1 else if t2 < t0 and t1 < t0 then t2 else if t0 = t1 then t1 else if (List.Count({t1..t0}) + List.Count({t1..t0})) < (List.Count({t3..t2}) + List.Count({t3..t2})) then t1 else t2
][Resultat]}})

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

Hi

I was wondering if that could be the sollution as well.

Unfortunately i still get the same error message on a handfull of cells:

Neseren_0-1726735530440.png

 

Neseren
Frequent Visitor

Just to make it clear, the duplicates is in the column "Batchnummer".

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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