To show every day an event was active, generate a list of dates between its start and end in Power Query, then expand that list into rows. This solves a common calendar problem. A maintenance window that runs November 23–25 should appear on Tuesday the 24th too, even though the source records only Monday and Wednesday.
Build an event-by-day table
- In Power BI Desktop, choose Home → Transform data. In Power Query, right-click your events query and choose Reference. Name the new query
EventDays. The original query stays at one row per event, which is useful for budgets or counts that belong to the event as a whole. - Keep the event identifier and the two date columns. The example uses
EventID,EventDate(the start), andEndDate. Set the two date columns to the Date data type. If your source contains timestamps, decide which local calendar dates they represent before dropping the time. - Choose Add Column → Custom Column. Name it
ActiveDateand enter the expression below. Substitute your own column names if they differ.
if [EventDate] = null or [EndDate] = null then
{null}
else if [EndDate] < [EventDate] then
{null}
else
List.Dates(
[EventDate],
Duration.Days([EndDate] - [EventDate]) + 1,
#duration(1, 0, 0, 0)
)
List.Dates takes a starting date, a count, and a step. The difference between Monday and Wednesday is two days. Adding one generates three dates, including both endpoints. A one-day event generates one row. This example treats the recorded end date as the last active day. If your source stores the first inactive day instead, omit + 1 and keep only intervals whose end is later than their start.
- Select OK. Open the expand button in the
ActiveDatecolumn header and choose Expand to New Rows. Set the expanded column’s type to Date. - Check rows with a blank
ActiveDate. The formula leaves a blank when either endpoint is missing or the dates run backward. Correct the source, or filter blank dates out ofEventDaysbefore building a daily count. An open-ended assignment needs its own reporting cutoff. - Select Home → Close & Apply. Build a table visual with
ActiveDateand Distinct count ofEventID. Use the date field itself for a row per day. A report with a separate calendar table can relate its unique date column toEventDays[ActiveDate]and use the calendar date in visuals.
Check an overlap before trusting the chart
Download the two-event CSV and open it with Get data → Text/CSV to try these exact rows. Event A runs November 23–25. Event B starts and ends November 24. The expanded query should have four rows. The daily visual should show these three results.
| Active date | Active events | Distinct count |
|---|---|---|
| November 23 | A | 1 |
| November 24 | A, B | 2 |
| November 25 | A | 1 |
Across all three dates the distinct event count is two. The four rows measure event-days. This distinction matters for amounts too. A $300 budget stored on Event A would appear three times if you carried it into the expanded rows. Sum budgets from the original event table, or define a daily allocation if that is what the report needs.
Microsoft documents the custom column editor, the List.Dates function, and what happens to the other columns when a list expands.