Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ThomasWeppler
Impactful Individual
Impactful Individual

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
slorin
Super User
Super User

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 

View solution in original post

1 REPLY 1
slorin
Super User
Super User

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 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors