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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Fill in values where id is duplicated

I am trying to fill in values in the column "tags_Sprints" where the id is duplicated.

Put another way, if "tags_Sprints" is not null, I want the value to show in all instances within that same id.

 

So, if this is the table:

KapBI_1-1637768507748.png

I want the column tags_Sprints (or a new column) to show values like this:

KapBI_2-1637769922537.png

Is that clear enough?

 

EDIT: attaching the table.

idtagstags_KI  tags_SprintsSprint_Date
2306    
2305    
2304KI-7412KI-7412  
2304Sprint2021.12.14 Sprint2021.12.1412/14/2021
2303    
2302KI-7413KI-7413  
2301KI-7411KI-7411  
2301Sprint2021.12.14 Sprint2021.12.1412/14/2021
2300    

 

Thanks in advance.

6 REPLIES 6
v-xiaoyan-msft
Community Support
Community Support

Hi @Anonymous ,

 

Does the replies above solve your problem? If it has been solved, please mark the correct reply as the standard answer to help the other members find it more quickly.Thanks in advance for your kind cooperation!

 

Hope it helps,


Community Support Team _ Caitlyn

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

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. 

Anonymous
Not applicable

OK. I edited and pasted the data into a table.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjI2MFPSUVJAwbE6YAlTXBImQI63p665iaERCgtDUXBBUWZeiZGBkaGeoZGeoQlUDRZhQyN9QxN9kBBMvzEu2xF2GqOwUBQZwqVQWRiKKHGiAaYTYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, tags = _t, #"tags_KI  " = _t, tags_Sprints = _t, Sprint_Date = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,each [tags_Sprints]=" ",
(k)=> List.Max(Table.SelectColumns(Table.SelectRows(Source, each [id]=k[id]), "tags_Sprints")[tags_Sprints]),
(orig, test, repl)=> if test then repl else orig,{"tags_Sprints"})
in
    #"Replaced Value"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

Anonymous
Not applicable

Thank you @lbendlin !

It works perfectly on a new Query, however, when I apply it to my full table, it doesn't work.

It doesn't break the query, but it doesn't fill in any values either.

What do you think is going on? What do you need?
The only difference is that blank values in my full table are "null" instead of blank, but I don't that should affect the output.

Please provide sanitized sample data that fully covers your issue.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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