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.
Hi all
I'm completely new to Power BI Desktop but I'm already loving it.
I have a question toward change cells in an imported feed.
How do I do that the best way? (I can't just change the cell).
From:
Text | Number
a | 10
b | null
c | 30
d | null
To:
Text | Number
a | 10
b | 20
c | 30
d | 40
Something like:
If text.B = null then Number = 20
If text.D = null then Number = 40
I have tried to make a conditional column, but that will add another column. Can't I do it so had I only have one column?
(Much easier for me to work with).
Best regards
Christian
Solved! Go to Solution.
@Anonymous here are the steps, just create blank query and copy following code and same you can apply in your table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTI0UIrViVZKAjLzSnNywJxkIMcYIp4CF48FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Text = _t, Data = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Text", type text}, {"Data", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "New Data", each if [Text] = "b" and [Data] = null then 20 else
if [Text] = "d" and [Data] = null then 40 else
[Data]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"New Data", Int64.Type}})
in
#"Changed Type1"
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Anonymous here are the steps, just create blank query and copy following code and same you can apply in your table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUTI0UIrViVZKAjLzSnNywJxkIMcYIp4CF48FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Text = _t, Data = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Text", type text}, {"Data", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "New Data", each if [Text] = "b" and [Data] = null then 20 else
if [Text] = "d" and [Data] = null then 40 else
[Data]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"New Data", Int64.Type}})
in
#"Changed Type1"
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi again Parry2k
That worked perfectly, thank you again!
Wow that was a fast answer! Thank you so much Parry2K, I will try that soon.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |