Forum Discussion

apoje's avatar
apoje
Icon for Helper II rankHelper II
5 years ago
Solved

How to replace one item with a different one – apply transformation?

Hi,

 

I would like to transform one of my items in the database based on its variation number.

The end result would be a transformation of the variation number and multiplication of its quantity column.

 

 

Initial data - I want to apply the transformation on the variation 0527: 

Order.IDVariation.NumberQuantity
12305275
124123410
12512391

 

 

dataset with the applied transformation (variation number 0527 was transformed to 1999 and its quantity multiplied by 10):

Order.IDVariation.NumberQuantity
123199950
124123410
12512391

 

Would something like that be possible?

 

Also, my data set is 100000 lines – I imagine this is not too much for PQ 😊

 

Thanks for the help!

Andraz

  • Hi, apoje 

     

    Try this, for 100,000 lines please wait about 20 seconds to upload to excel.

    let
        Source = Excel.CurrentWorkbook(){[Name="Table25"]}[Content],
        Custom1 = Table.FromRecords(List.Transform(Table.ToRecords(Source),each if [Variation.Number]="0527" then _&[Variation.Number=1999]&[Quantity=[Quantity]*10] else _))
    in
        Custom1

     

4 Replies

  • Hi, apoje 

     

    Try this, for 100,000 lines please wait about 20 seconds to upload to excel.

    let
        Source = Excel.CurrentWorkbook(){[Name="Table25"]}[Content],
        Custom1 = Table.FromRecords(List.Transform(Table.ToRecords(Source),each if [Variation.Number]="0527" then _&[Variation.Number=1999]&[Quantity=[Quantity]*10] else _))
    in
        Custom1

     

    • apoje's avatar
      apoje
      Icon for Helper II rankHelper II

      shaowu459 awesome! Do you know on the upper limit for lines of data to be still acceptable to use PQ?

      • shaowu459's avatar
        shaowu459
        Icon for Resolver II rankResolver II

        I don't know the exact upper limit, But  several million lines would not be problem. For large data, you may import and export from CSV, access, sql, etc.