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

Power Query

Ronak_Mistry_0-1668142628886.png

Hello, 

I want fill all blank value in PartyType with respect to Code Coloum.

 

like.    Code = A0103 and Value of Party Type is d
this value fill everywhere when used code is equal to A0103.

Similary with Next Code.

 

I want this Output

Ronak_Mistry_1-1668142931028.png

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Ronak_Mistry ,

 

1) Group your table on code and create one aggregate column using the 'All Rows' operator, and one using MAX of [Party Type].

2) Expand your nested table column back out to reinstate your original rows.

 

Example Code:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQwNDBW0lFSitWJVqqoNDA2gnGSjE0MTBEyVUBmaiqYA9OTQpQmFC0oOhITSdeDoqOsDEVPLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Code = _t, PartyType = _t]),
    groupAllRows = Table.Group(Source, {"Code"}, {{"data", each _, type table [Code=nullable text, PartyType=nullable text]}, {"maxPartyType", each List.Max([PartyType]), type nullable text}}),
    expandData = Table.ExpandTableColumn(groupAllRows, "data", {"PartyType"}, {"PartyType"})
in
    expandData

 

 

Example output:

BA_Pete_0-1668155670688.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

1 REPLY 1
BA_Pete
Super User
Super User

Hi @Ronak_Mistry ,

 

1) Group your table on code and create one aggregate column using the 'All Rows' operator, and one using MAX of [Party Type].

2) Expand your nested table column back out to reinstate your original rows.

 

Example Code:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQwNDBW0lFSitWJVqqoNDA2gnGSjE0MTBEyVUBmaiqYA9OTQpQmFC0oOhITSdeDoqOsDEVPLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Code = _t, PartyType = _t]),
    groupAllRows = Table.Group(Source, {"Code"}, {{"data", each _, type table [Code=nullable text, PartyType=nullable text]}, {"maxPartyType", each List.Max([PartyType]), type nullable text}}),
    expandData = Table.ExpandTableColumn(groupAllRows, "data", {"PartyType"}, {"PartyType"})
in
    expandData

 

 

Example output:

BA_Pete_0-1668155670688.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




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.

Top Solution Authors
Top Kudoed Authors