Forum Discussion
Anonymous
7 years agoNot applicable
Calculate New Table - "For Loop" - Repeat Table A based on Table B
Hello, I'd like to create a new table (Table C) based upon contents of Table A and Table B. I imagine as much what I am trying to achieve is a For Loop. Dummy data can be found below: Tab...
- 7 years ago
Hi,
Here's the M code
let Source = Table1, #"Added Custom" = Table.AddColumn(Source, "Custom", each Table2), #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Mth Year"}, {"Mth Year"}), #"Reordered Columns" = Table.ReorderColumns(#"Expanded Custom",{"Mth Year", "Team", "Sub team"}), #"Changed Type with Locale" = Table.TransformColumnTypes(#"Reordered Columns", {{"Mth Year", type date}}, "en-IN"), #"Sorted Rows" = Table.Sort(#"Changed Type with Locale",{{"Mth Year", Order.Ascending}, {"Team", Order.Ascending}, {"Sub team", Order.Ascending}}) in #"Sorted Rows"
PattemManohar
Community Champion
7 years agoAnonymous If you want to achieve the same output in DAX, then please try as below
Test272Out = VAR _MonthYear = VALUES(Test272CrossJoinT2[MonthYear]) RETURN CROSSJOIN(Test272CrossJoinT1,_MonthYear)