cancel
Showing results for
Did you mean:
Continued Contributor

## I need to make a table with all the times we need to visit a customer

Hi Power Bi community

I want to expand my table with a lot more rows depending on values in some of the tabels columns.

I have the following columns:

1. Index (an index column)

2. Interval (a text column with the text "Annually", "Weekly" or "Daily"

3. Startdate (a date column that says when to start)
4. Enddate (a date column that says when to end)

If a row's interval value is Annually I need a row for each year between the start date and the end date
If a row's interval value is Weekly I need a row for each week between the start date and the end date

If a row's interval value is Daily I need a row for each day between the start date and the end date

Can some help me in the right direction?
All help is greatly appreciated.

1 ACCEPTED SOLUTION
Solution Sage

Hi,

Add a new column

`if [Interval]="Annually" then {Date.Year([Startdate])..Date.Year([Enddate])}else if [Interval]="Weekly" then List.Dates([Startdate], Duration.Days([Enddate]-[Startdate])/7,#duration(7,0,0,0))else if [Interval]="Daily" then List.Dates([Startdate], Duration.Days([Enddate]-[Startdate]),#duration(1,0,0,0))else null)`

Stéphane

Solution Sage

Hi,

Add a new column

`if [Interval]="Annually" then {Date.Year([Startdate])..Date.Year([Enddate])}else if [Interval]="Weekly" then List.Dates([Startdate], Duration.Days([Enddate]-[Startdate])/7,#duration(7,0,0,0))else if [Interval]="Daily" then List.Dates([Startdate], Duration.Days([Enddate]-[Startdate]),#duration(1,0,0,0))else null)`

Stéphane

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors