Results 1 to 1 of 1

Power Query multiply rows of one table by row of another

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    771

    Power Query multiply rows of one table by row of another

    Hi I am trying to replicate in power query what in excel could be ;

       =MMULT(Table32[@[One]:[Three]],Table4[Amount])*[@Units]
    I have managed this but it took a lot of nesting list transformation, I have include a version where I named all the steps individually for clarity

    let
        Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        rechead = ( tax [tax]),
        startlist = List.Transform(  Table.ToRows(  Source ),
    (x)=> List.Skip( List.RemoveLastN( x ,1) ,1) 
    ),
        ziplist = List.Transform(  startlist, (x)=>  List.Zip ( { x, tax [Amount] } ) ),
     product = List.Transform(  ziplist, (x)=>  List.Transform( x , (y)=>  List.Product(y) )),
        sum = List.Transform(  product, (x)=> List.Sum( x ) ),
        result = List.Transform( List.Zip(  { sum, Source [Units] } ), (x)=> List.Product( x )  ),
        Custom3 = result
    in
        Custom3
    if anyone has any ideas on simplifying this I would like to know, I have thought of using records, but have not tried yet.

    Richard
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Power Query multiply Column list by row valuus
    By Dicken in forum Office 365
    Replies: 2
    Last Post: 03-07-2024, 08:38 AM
  2. Replies: 5
    Last Post: 10-09-2023, 05:05 AM
  3. Power Query Multiply column in transform
    By Dicken in forum Office 365
    Replies: 1
    Last Post: 04-11-2023, 10:00 AM
  4. Power Query Table Select Rows
    By Dicken in forum Office 365
    Replies: 0
    Last Post: 02-10-2023, 12:41 PM
  5. Replies: 0
    Last Post: 04-12-2022, 01:58 PM
  6. [SOLVED] Power Query - Expression Error: The Key didn't match any rows in the table
    By Baltimorejack68 in forum Excel General
    Replies: 7
    Last Post: 10-18-2019, 04:24 PM
  7. [SOLVED] Power Query: Extract data from table after other rows are filtered
    By JimDandy in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-25-2017, 02:10 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1