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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
MansRydell
Helper II
Helper II

multiply columns by one column

Hi All

 

I need to transform a bunch of columns by multiplying them on row level by values in a column:

Ex in tabel below I need to multiply Column2, Column3 & Column4 by Column1

Column1Column2Column3Column4
2121
3113

 

After transformation of columns we get:

Column1Column2Column3Column4
2242
3339

 

It feels like one should be able to do this in one step with M code. what I basicly whant to do is:  for each of these columns multiply the value on each row with the value in this column on same row.

Does anyone know if this is possible?


1 ACCEPTED SOLUTION
MansRydell
Helper II
Helper II

Sorted it out my self, this worked.

Table.FromRecords(Table.TransformRows(#"Changed Type", (x) => Record.TransformFields(x, List.Transform({"Column2", "Column3", "Column4"}, (y) => {y, each x[Column1] * _}))))

View solution in original post

1 REPLY 1
MansRydell
Helper II
Helper II

Sorted it out my self, this worked.

Table.FromRecords(Table.TransformRows(#"Changed Type", (x) => Record.TransformFields(x, List.Transform({"Column2", "Column3", "Column4"}, (y) => {y, each x[Column1] * _}))))

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors