Forum Discussion

amolkulkarnigk1's avatar
amolkulkarnigk1
Regular Visitor
2 years ago
Solved

Unpivot table w

I have a table as below

 

Wrong Rate

Sr. No  Name  Appl. No  PolicyRate 

1          Abc     1234         10

2          zxc      1224         11

Need one additional column which shows values from 1st header i. e as "Wrong Rate" In each row of table

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi amolkulkarnigk1 ,

    Based on the description, I'm assuming your table looks like this:

    You can get the value of Wrong Rate by adding a custom column(After the twice Promoted Headers):

    Advanced editor.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtAzMlLSUYKiWJ1opeAiPQW/fCDPLzE3FUg5FhTkQEUC8nMykyuDEktSwSoNQbJJyUDS0MjYBEQZgMVBBlZVQMSNwOKGSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
        #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
        #"Promoted Headers1" = Table.PromoteHeaders(#"Promoted Headers", [PromoteAllScalars=true]),
        #"Added Custom" = Table.AddColumn(#"Promoted Headers1", "Wrong Rate", each Source[Column1]{0})
    in
        #"Added Custom"

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

2 Replies

  • PijushRoy's avatar
    PijushRoy
    Community Champion

    Hi amolkulkarnigk1 

    I am not clear with your requirement, if the below solution is not working, please share more details and a screenshot of the requirement.


    Try this, Create a Custom Column in Power Query
    Give column name
    In formula box, type

    ="Wrong Rate"

    It will create a new column with the Wrong Rate text

     
    If solved your requirement, please mark this answer as SOLUTION.
    If this comment helps you, appreciate your KUDOS

    Thanks 
    Pijush

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi amolkulkarnigk1 ,

    Based on the description, I'm assuming your table looks like this:

    You can get the value of Wrong Rate by adding a custom column(After the twice Promoted Headers):

    Advanced editor.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtAzMlLSUYKiWJ1opeAiPQW/fCDPLzE3FUg5FhTkQEUC8nMykyuDEktSwSoNQbJJyUDS0MjYBEQZgMVBBlZVQMSNwOKGSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
        #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
        #"Promoted Headers1" = Table.PromoteHeaders(#"Promoted Headers", [PromoteAllScalars=true]),
        #"Added Custom" = Table.AddColumn(#"Promoted Headers1", "Wrong Rate", each Source[Column1]{0})
    in
        #"Added Custom"

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group