cancel
Showing results for
Did you mean:
Highlighted
Member

## Duplicate rows with new values

Hi,

I have a table like that :  Customer|Date|amount

I need to duplicate each row 12 times each time with the next month

example:

original row

customer   |   Date    | amount

1                | 1/1/17   | 100

I need it to be like :

customer   |   Date    | amount

1                | 1/1/17   | 100

1                | 1/2/17   | 100

1                | 1/3/17   | 100

1                | 1/4/17   | 100

Is it possible to do it with power bi?

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Duplicate rows with new values

Hi @Drors

Try this solution

Go to Modelling Tab>>> New Table

```New Table =
GENERATE (
TableName,
VAR mymonth = MONTH ( TableName[Date] ) RETURN GENERATESERIES ( 0, 11, 1 )
)```

```New date =
DATE ( YEAR ( 'New Table'[Date] ), MONTH ( 'New Table'[Date] ) + 'New Table'[Value], DAY ( 'New Table'[Date] ) )```
7 REPLIES 7
Super User

## Re: Duplicate rows with new values

Hi @Drors

Try this solution

Go to Modelling Tab>>> New Table

```New Table =
GENERATE (
TableName,
VAR mymonth = MONTH ( TableName[Date] ) RETURN GENERATESERIES ( 0, 11, 1 )
)```

```New date =
DATE ( YEAR ( 'New Table'[Date] ), MONTH ( 'New Table'[Date] ) + 'New Table'[Value], DAY ( 'New Table'[Date] ) )```
Super User

Super User

## Re: Duplicate rows with new values

HI @Drors

I added one more row for testing

Member

## Re: Duplicate rows with new values

wow thank you it works!

Do you have any idea how to do it with a regular table and not calculated one, I think it will make my work difficault later..

and again, Thank you very much, I work on it all day

Super User

## Re: Duplicate rows with new values

Hi @Drors

I will look into Power Query solution

@MarcelBeugcould you help?

Super User

## Re: Duplicate rows with new values

This would be my Power Query solution:

```let
Source = TableName,
DateList = Table.TransformColumns(Source,{{"Date", (startdate) => List.Transform({0..11}, each Date.AddMonths(startdate,_)), type {date}}}),
#"Expanded Date" = Table.ExpandListColumn(DateList, "Date")
in
#"Expanded Date"```
Specializing in Power Query Formula Language (M)
Member

## Re: Duplicate rows with new values

@MarcelBeug

Thank you its working!