cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jag_G12345
New Member

How to create a column with a specific row value.

Hi, I'm in a bind with power bi desktop. Currently the data is like this: 

 

Jag_G12345_0-1648046363449.png

 

I'm trying to create a visual that shows the score of each area. Like this: 

 

Jag_G12345_1-1648046697404.png

 

 

My issue is that the area is also listed in the rows, i'm trying to extract it to create a new column not sure how to proceed. 

1 ACCEPTED SOLUTION
kumarthombre20
Resolver I
Resolver I

@Jag_G12345 Attached pbix file FYR.
Few Power query transformation required to prepare the data in the tabular model.

kumarthombre20_0-1648054793223.png

 

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNlHSUXIsSk0EUUqxOtFKQEZxcn5RqiGQYWiJImQEEjICCxmbmBqZIbQ6YWo1wdRqDhYyNzM3NUVodcbUaoyp1VApNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Audit ID" = _t, Category = _t, Response = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Audit ID", Int64.Type}, {"Category", type text}, {"Response", type text}}),
    #"Filled Down" = Table.FillDown(#"Changed Type",{"Audit ID"}),
    #"Added Conditional Column" = Table.AddColumn(#"Filled Down", "Custom", each if Text.StartsWith([Category], "Area") then "Category" else "Response"),
    #"Pivoted Column" = Table.Pivot(#"Added Conditional Column", List.Distinct(#"Added Conditional Column"[Category]), "Category", "Response"),
    #"Removed Columns" = Table.RemoveColumns(#"Pivoted Column",{"Custom"}),
    #"Filled Down1" = Table.FillDown(#"Removed Columns",{"Area"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down1", each ([score1] <> null)),
    #"Changed Type1" = Table.TransformColumnTypes(#"Filtered Rows",{{"score1", Int64.Type}, {"score2", Int64.Type}})
in
    #"Changed Type1"


If this post helps, then please consider Accept it as the solution
Thanks,
Kumar

View solution in original post

2 REPLIES 2
kumarthombre20
Resolver I
Resolver I

@Jag_G12345 Attached pbix file FYR.
Few Power query transformation required to prepare the data in the tabular model.

kumarthombre20_0-1648054793223.png

 

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNlHSUXIsSk0EUUqxOtFKQEZxcn5RqiGQYWiJImQEEjICCxmbmBqZIbQ6YWo1wdRqDhYyNzM3NUVodcbUaoyp1VApNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Audit ID" = _t, Category = _t, Response = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Audit ID", Int64.Type}, {"Category", type text}, {"Response", type text}}),
    #"Filled Down" = Table.FillDown(#"Changed Type",{"Audit ID"}),
    #"Added Conditional Column" = Table.AddColumn(#"Filled Down", "Custom", each if Text.StartsWith([Category], "Area") then "Category" else "Response"),
    #"Pivoted Column" = Table.Pivot(#"Added Conditional Column", List.Distinct(#"Added Conditional Column"[Category]), "Category", "Response"),
    #"Removed Columns" = Table.RemoveColumns(#"Pivoted Column",{"Custom"}),
    #"Filled Down1" = Table.FillDown(#"Removed Columns",{"Area"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down1", each ([score1] <> null)),
    #"Changed Type1" = Table.TransformColumnTypes(#"Filtered Rows",{{"score1", Int64.Type}, {"score2", Int64.Type}})
in
    #"Changed Type1"


If this post helps, then please consider Accept it as the solution
Thanks,
Kumar

amitchandak
Super User
Super User

@Jag_G12345 , In power query in Transform data -> split column by digit and non digit and create two columns

 

Split Column By Digit to Non Digit & Non Digit to Digit: https://youtu.be/tY4Yk1crS9s

 

Then use fill down -Fill Up Fill Down: https://youtu.be/mC2ps0pFqBI

 

then filter the rows with null response (number column)

 

and then use it



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors