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

Changing duplicates into Null

Hi all,

 

I would like to change duplicates in my row into null

 

For example this as my original table, where I would like to change the orange boxes into null as they are replication.

P1.PNG

 

Becoming into this:

P2.PNG

 

and Ideally my end product is do calculate the Score based on the Type.

P3.PNG

 

Hope someone can give some guidance.

 

Many thanks.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jinweitan , better try a measure like

 

Measure = AVERAGEX(SUMMARIZE (filter('Table 1',not(isblank('Table 1'[Score]))),'Table 1'[GUID],'Table 1'[Type],'Table 1'[Score]),[score])

View solution in original post

2 REPLIES 2
camargos88
Community Champion
Community Champion

@jinweitan ,

 

This is a Power Query Solution:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYkMDpVgdnFwwxwjKMcLBc0Log3GVYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [GUID = _t, TYPE = _t, SCORE = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"GUID", Int64.Type}, {"TYPE", type text}, {"SCORE", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"GUID", "TYPE", "SCORE"}, {{"Rows", each Table.AddColumn(Table.AddIndexColumn(_, "Index", 1,1), "Score_2", each if [Index] > 1 then null else [SCORE]), type table }}),
    #"Removed Other Columns" = Table.SelectColumns(#"Grouped Rows",{"Rows"}),
    #"Expanded Rows" = Table.ExpandTableColumn(#"Removed Other Columns", "Rows", {"GUID", "TYPE", "Index", "Score_2"}, {"GUID", "TYPE", "Index", "Score_2"}),
    #"Renamed Columns" = Table.RenameColumns(#"Expanded Rows",{{"Score_2", "SCORE"}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"GUID", Int64.Type}, {"TYPE", type text}, {"Index", Int64.Type}, {"SCORE", Int64.Type}})
in
    #"Changed Type1"

 

Capture.PNG



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

Proud to be a Super User!



amitchandak
Super User
Super User

@jinweitan , better try a measure like

 

Measure = AVERAGEX(SUMMARIZE (filter('Table 1',not(isblank('Table 1'[Score]))),'Table 1'[GUID],'Table 1'[Type],'Table 1'[Score]),[score])

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.