Forum Discussion

jinweitan's avatar
jinweitan
Frequent Visitor
5 years ago
Solved

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.

 

Becoming into this:

 

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

 

Hope someone can give some guidance.

 

Many thanks.

  • 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])

2 Replies

  • 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])

  • camargos88's avatar
    camargos88
    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"