Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I am looking to make a computed table using a date table and a list of properties that shows the occupancy % for each property and each month.
The table would essentially look like this:
I have tried what I know to pivot/unpivot data in the two tables but I can't figure out how to essentially duplicate the calendar month for every property in the list (about 200).
What the best way to create this summary table?
Thanks!
Solved! Go to Solution.
I think you will need to use a Cross Join trick in Power Query where you basically drop one table into a new column, then expand.
This code will create a table of 12 months all using the first of the month. Jan 1, 2020, Feb 1, 2020, etc..
let
Source = Table.FromList({1..12}, Splitter.SplitByNothing(), {"Date"}, null, ExtraValues.Error),
#"Convert to Date" = Table.TransformColumns(Source, {{"Date", each #date(2020,_,1), type date}})
in
#"Convert to Date"
Then do the following:
If you want to get fancy, you could do all of that in your main table without a new query. The M code is a bit tedious to type in and harder to follow, but same result.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmAyEUwmgclkpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Property = _t]),
#"Added Date Column" =
Table.AddColumn(
Source, "Date",
each
Table.TransformColumns(
Table.FromList({1..12}, Splitter.SplitByNothing(), {"Date"}, null, ExtraValues.Error),
{{"Date", each #date(2020,_,1), type date}}
)
),
#"Expanded Date" = Table.ExpandTableColumn(#"Added Date Column", "Date", {"Date"}, {"Date"})
in
#"Expanded Date"
The #"Added Date Column" is the relevant step.
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingI think you will need to use a Cross Join trick in Power Query where you basically drop one table into a new column, then expand.
This code will create a table of 12 months all using the first of the month. Jan 1, 2020, Feb 1, 2020, etc..
let
Source = Table.FromList({1..12}, Splitter.SplitByNothing(), {"Date"}, null, ExtraValues.Error),
#"Convert to Date" = Table.TransformColumns(Source, {{"Date", each #date(2020,_,1), type date}})
in
#"Convert to Date"
Then do the following:
If you want to get fancy, you could do all of that in your main table without a new query. The M code is a bit tedious to type in and harder to follow, but same result.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmAyEUwmgclkpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Property = _t]),
#"Added Date Column" =
Table.AddColumn(
Source, "Date",
each
Table.TransformColumns(
Table.FromList({1..12}, Splitter.SplitByNothing(), {"Date"}, null, ExtraValues.Error),
{{"Date", each #date(2020,_,1), type date}}
)
),
#"Expanded Date" = Table.ExpandTableColumn(#"Added Date Column", "Date", {"Date"}, {"Date"})
in
#"Expanded Date"
The #"Added Date Column" is the relevant step.
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThank you!
I didn't need to go with the fancy code at the bottom, just the concept of the first section was what I needed. I had done this before for another reason but I couldn't remember what to do to make the whole of the calendar apply to each property.
Excellent @ctaylor - glad I was able to help out.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCheck out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 7 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 15 | |
| 13 | |
| 12 | |
| 9 |