Reputation: 193
I have a table loaded in Power BI like this:
Name | Value 1 | Value 2 |
---|---|---|
Marc | 21 | 32 |
Marc | 21 | 33 |
Jessica | 32 | 353 |
Jessica | 32 | 313 |
John | 31 | 323 |
John | 31 | 333 |
Tim | 35 | 342 |
Tim | 35 | 331 |
I would like to use Power Query in Power BI to duplicate rows, where the name is for example John:
Name | Value 1 | Value 2 |
---|---|---|
Marc | 21 | 32 |
Marc | 21 | 33 |
Jessica | 32 | 353 |
Jessica | 32 | 313 |
John | 31 | 323 |
John | 31 | 333 |
Tim | 35 | 342 |
Tim | 35 | 331 |
John | 31 | 323 |
John | 31 | 333 |
How can I do it with Powery Query in Power BI?
Thanks!
Upvotes: 1
Views: 782
Reputation: 30304
Here you go. Just one line of code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k0sSlZQ0lEyMgSRxkZKsToYgsZgQa/U4uLM5ESIMjBpikvCECqRn5EH5kKksAlCzQ7JzIWYCCZNjLAIGhsqxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, #"Value 1" = _t, #"Value 2" = _t]),
#"Filtered Rows" = Table.Combine({ Table.SelectRows(Source, each ([Name] = "John")),Source})
in
#"Filtered Rows"
Upvotes: 2