The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi to everyone,
I grouped a table in this way, i am interested to the months, to fill all the cells of the group
= Table.Group(Source, {"Code"}, {{"data", each Table.FillUp(Table.FillDown(_, {"gen","feb"}),{"gen","feb"}), type table}})
This is ok if the number of months is static, but this number increase every month.
I tried to replace both {"gen","feb"}) in the code above with a list containing the months in the table titles but, of course, it doesn't funcion (easy things never function, its Murphy law)
each Table.FillUp(Table.FillDown(_, {MonthTitles}),{MonthTitles}), type table}})
MohtTitle in this example contains gen, feb then il will contains gen, feb, march and so on
What's the right code?
Thank you in advance
Solved! Go to Solution.
@LukeReds if MonthTitle is the list then don't use curly braces.
Alternatively: create a full list of all possible month titles:
all_months = {"gen", "feb", "march"....} and then find intersection of your column names and this list:
MonthTitles = List.Intersect({Table.ColumnNames(Source), all_months})
and then
Table.FillUp(Table.FillDown(_, MonthTitles), MonthTitles), type table}})
thank you to everyone!
you to everyone, i will never understand those crazy curly brackets!!
@LukeReds if MonthTitle is the list then don't use curly braces.
Alternatively: create a full list of all possible month titles:
all_months = {"gen", "feb", "march"....} and then find intersection of your column names and this list:
MonthTitles = List.Intersect({Table.ColumnNames(Source), all_months})
and then
Table.FillUp(Table.FillDown(_, MonthTitles), MonthTitles), type table}})
Table.ColumnNames(_) will return a List of all the column names. Depending on how your table is arranged, you can select just those columns that contain the month names.
For example, if your month columns start at column 3, then something like List.Skip(Table.ColumnNames(_),2) would return a List of just the month columns. And there are other ways to select the month columns if your arrangement is more comples.