Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
bestmbaman
Frequent Visitor

Re-using the

Hi community,

I have a table in which I have a mix of number values, calculated values in one row and one row containing text values as you see a simpliefied version in the following screenshot:

bestmbaman_0-1713801234563.jpeg

So my outmost goal is to being able to achieve following modifications on the table but in a manner I describe after the screenshot:

bestmbaman_1-1713801605060.jpeg

I want to freeze the transformed table after first steps upon importing it to Power Query (perhaps using table.buffer function) and then do some transformaiton like filtering the rows with text values and modifying the numbers values on the rows with numerical data. And finally call the steps that were created before and append them to the new table that was transformed and then make the table look like what I shared as a second screenshot. 

Please note that I don't want to segregate the tables in to two separated tables for doing transformations and then append them back again. So, the only solution I am looking for is to do all the transformaiton steps in the same table by freezing it after couple of steps then recalling those earlier after some transformation steps.

Your help is much appreciated!

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

You can use Table.Combine to combine your resulting table with a previous step in the same table. 
Here is a small sample code to illustrate...

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8szLLMlMzFFwSSxJVIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    stepOne = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    stepTwo = Table.TransformColumns(stepOne,{{"Column1", Text.Upper, type text}}),
    stepThree = Table.TransformColumns(stepTwo,{{"Column1", Text.Length, Int64.Type}}),
    stepFour = Table.TransformColumns(stepThree, {{"Column1", each _ * 99, Int64.Type}}),
    stepFive = Table.Combine({stepTwo, stepFour})
in
    stepFive

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
jgeddes
Super User
Super User

You can use Table.Combine to combine your resulting table with a previous step in the same table. 
Here is a small sample code to illustrate...

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8szLLMlMzFFwSSxJVIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    stepOne = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    stepTwo = Table.TransformColumns(stepOne,{{"Column1", Text.Upper, type text}}),
    stepThree = Table.TransformColumns(stepTwo,{{"Column1", Text.Length, Int64.Type}}),
    stepFour = Table.TransformColumns(stepThree, {{"Column1", each _ * 99, Int64.Type}}),
    stepFive = Table.Combine({stepTwo, stepFour})
in
    stepFive

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.