Forum Discussion

lokeswer's avatar
lokeswer
Helper I
6 years ago
Solved

Multiplying 2 tables based on a date

Thanks for helping me out on this. I'm one of the people making the transition from excel.  I'm trying to get the daily consumption of a facility by input types.  E.g each product we make is stored...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    lokeswer - OK, in DAX you would do a CROSSJOIN I believe, like this:

     

    New Table = CROSSJOIN('Table','Table2')
     
    You could create your calculated column there or you could do it in the formula by adding ADDCOLUMNS.
     
    In Power Query, you do a cross join like this:
     

    lokeswer - OK, in DAX you would do a CROSSJOIN I believe, like this:

     

    New Table = CROSSJOIN('Table','Table2')
     
    You could create your calculated column there or you could do it in the formula by adding ADDCOLUMNS.
     
    In Power Query, you do a cross join like this:
     
    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtE3NtA3MjAyUNJRMjQwAFNAWilWJ1rJVN8QJmUBljGFSxgh6wHRZiAqNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t, Production = _t, Usage = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Production", Int64.Type}, {"Usage", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Table2),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Inputs", "BOM%"}, {"Custom.Inputs", "Custom.BOM%"})
    in
    #"Expanded Custom"