Forum Discussion
RMV
Helper V
7 years agoduplicating row until next date or today's date
Hi guys, I need help to duplicate rows with some conditions: 1. each row is duplicated until next update date 2. if the latest update date is before today's date, that latest row is duplicated ...
- 7 years ago
Try this:
NewTable_V2 = GENERATE ( Table1; GENERATESERIES ( CALCULATE ( MIN ( Table1[Date] ) ); VAR FirstDay_ = CALCULATE ( MIN ( Table1[Date] ) ) VAR LastDay_ = CALCULATE ( MIN ( Table1[Date] ); FILTER ( ALL ( Table1[Date] ); Table1[Date] > FirstDay_ ); ALLEXCEPT ( Table1; Table1[Asset No.]; Table1[Type]; Table1[Capacity] ) ) RETURN IF ( ISBLANK ( LastDay_ ); TODAY (); LastDay_ - 1 ) ) )It fills up the last one up to today as you described initially. The new date column will be shown as "Value" and the old Date column is shown as well. You can use SELECTCOLUMNS to remove the old one and change the name of the new one.
Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.
Cheers

AlB
Community Champion
7 years agoTry this:
NewTable_V2 =
GENERATE (
Table1;
GENERATESERIES (
CALCULATE ( MIN ( Table1[Date] ) );
VAR FirstDay_ =
CALCULATE ( MIN ( Table1[Date] ) )
VAR LastDay_ =
CALCULATE (
MIN ( Table1[Date] );
FILTER ( ALL ( Table1[Date] ); Table1[Date] > FirstDay_ );
ALLEXCEPT ( Table1; Table1[Asset No.]; Table1[Type]; Table1[Capacity] )
)
RETURN
IF ( ISBLANK ( LastDay_ ); TODAY (); LastDay_ - 1 )
)
)
It fills up the last one up to today as you described initially. The new date column will be shown as "Value" and the old Date column is shown as well. You can use SELECTCOLUMNS to remove the old one and change the name of the new one.
Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.
Cheers ![]()