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
JoaoFidalgo94
Regular Visitor

convert null numbers for duplicate lines

Hi everyone!

 

Could you please help me with this issue?

 

For example this table:

Ref.Qtd. OKQtd. NOKCod. OPId.1

1533

27A

123456

1533248B123456
1533410C987654

 

Now, my problem is I want to keep the lines but i dont want to duplicate the values on "Qtd. OK" column, is there any way of null the duplicate value on "Qtd. OK" if lines of "Id.1" are the same? Or create a new column like "Ajust Qtd.Ok"? Like this:

 

Ref.Qtd. OKQtd. NOKCod. OPId.1

1533

27A

123456

1533null48B123456
1533410C987654
3 ACCEPTED SOLUTIONS
jgeddes
Super User
Super User

Grouping by Id.1 with no aggregation then filling down the Qtd. OK column might work for you.
pbix file attached with your example data.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Omid_Motamedise
Super User
Super User

You can select column "Qtd. OK" and from the transform tab pick Fill Down if all the first ref value does not include null, else make group by first, then use fill down

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

View solution in original post

Anonymous
Not applicable

Hi,

Thanks for the solution Omid_Motamedise  and jgeddes  offered, and i want to offer some more information for user to refer to.

hello @JoaoFidalgo94 , you can create a blank query and put the following code to advanced editor in power query.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ1NlbSUTICYnMgdgRiQyNjE1MzpVgdFFkTCyDhhFXaBCRqACScgdjSwtzM1EQpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Ref." = _t, #"Qtd. OK" = _t, #"Qtd. NOK" = _t, #"Cod. OP" = _t, Id.1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Ref.", Int64.Type}, {"Qtd. OK", Int64.Type}, {"Qtd. NOK", Int64.Type}, {"Cod. OP", type text}, {"Id.1", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Ref.", "Qtd. OK"}, {{"Count", each Table.AddIndexColumn(_,"Index",1,1),type table}}),
    #"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Qtd. NOK", "Cod. OP", "Id.1", "Index"}, {"Qtd. NOK", "Cod. OP", "Id.1", "Index"}),
    #"Replaced Value" = Table.ReplaceValue(#"Expanded Count",each [Qtd. OK],each if [Index]=1 then [Qtd. OK] else null,Replacer.ReplaceValue,{"Qtd. OK"}),
    #"Removed Columns" = Table.RemoveColumns(#"Replaced Value",{"Index"})
in
    #"Removed Columns"

Output

vxinruzhumsft_0-1729749353465.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

4 REPLIES 4
JoaoFidalgo94
Regular Visitor

Hi guys! Thanks a lot for your response, it works!

Anonymous
Not applicable

Hi,

Thanks for the solution Omid_Motamedise  and jgeddes  offered, and i want to offer some more information for user to refer to.

hello @JoaoFidalgo94 , you can create a blank query and put the following code to advanced editor in power query.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ1NlbSUTICYnMgdgRiQyNjE1MzpVgdFFkTCyDhhFXaBCRqACScgdjSwtzM1EQpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Ref." = _t, #"Qtd. OK" = _t, #"Qtd. NOK" = _t, #"Cod. OP" = _t, Id.1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Ref.", Int64.Type}, {"Qtd. OK", Int64.Type}, {"Qtd. NOK", Int64.Type}, {"Cod. OP", type text}, {"Id.1", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Ref.", "Qtd. OK"}, {{"Count", each Table.AddIndexColumn(_,"Index",1,1),type table}}),
    #"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Qtd. NOK", "Cod. OP", "Id.1", "Index"}, {"Qtd. NOK", "Cod. OP", "Id.1", "Index"}),
    #"Replaced Value" = Table.ReplaceValue(#"Expanded Count",each [Qtd. OK],each if [Index]=1 then [Qtd. OK] else null,Replacer.ReplaceValue,{"Qtd. OK"}),
    #"Removed Columns" = Table.RemoveColumns(#"Replaced Value",{"Index"})
in
    #"Removed Columns"

Output

vxinruzhumsft_0-1729749353465.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.

 

 

Omid_Motamedise
Super User
Super User

You can select column "Qtd. OK" and from the transform tab pick Fill Down if all the first ref value does not include null, else make group by first, then use fill down

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h
jgeddes
Super User
Super User

Grouping by Id.1 with no aggregation then filling down the Qtd. OK column might work for you.
pbix file attached with your example data.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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