Forum Discussion

tonybrogan's avatar
tonybrogan
Icon for Advocate I rankAdvocate I
2 years ago
Solved

Calculated Column - Fill Using Text From Another Column

Hi Everyone,   I'm struggling creating a calculated column for my dataset to fix a report issue but I'm now left wondering if it is even possible as I'm only using text fields (nothing numeric). I...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi tonybrogan 

    You can try the following solutions.

    1.Put the following code to advanced editor in power query

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwUNJRcnRyBpIKSrE6qCJe+akKTjn56enFEClDDMVEiBiBDXRxdcMq4pFYVFSp4FSUX56HQ7UxWCQiMopSEUN8IsElqWWpCo6lxSWZeTiUGxqYookYoaqJBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [DocumentNo = _t, Reference = _t, Employee = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"DocumentNo", Int64.Type}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Reference"}, {{"Count", each List.Max([Employee]), type nullable text}, {"Data", each _, type table [DocumentNo=nullable number, Reference=nullable text, Employee=nullable text]}}),
        #"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"DocumentNo", "Employee"}, {"DocumentNo", "Employee"}),
        #"Reordered Columns" = Table.ReorderColumns(#"Expanded Data",{"Reference", "DocumentNo", "Employee", "Count"})
    in
        #"Reordered Columns"

    Output

     

    2.You can create a calculated column

    Column =
    MAXX (
        FILTER (
            'Table (2)',
            [Reference] = EARLIER ( 'Table (2)'[Reference] )
                && [Employee] <> BLANK ()
        ),
        [Employee]
    )
    

    Output

    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.