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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Adding date column that grows with numbe of rows

In Power BI, I forecasted Value column using R in the Power Query editor. Then, once I had the forecasted value, I appended it to the original table, which resulted in something like this:

 

Date                             Value              
1/01/20215245
2/01/20213214
3/01/20217458
4/01/202136314
5/01/20215478
 2314
 5478
 63211
 2314
 52336
 1247

 

 

Now I want to add date to the projected values, creating rolling date rows that keeps groowing as the number of rows grows.

 

The final value should seem as follows:

 

Date                             Value              
1/01/20215245
2/01/20213214
3/01/20217458
4/01/202136314
5/01/20215478
6/1/20212314
7/1/20215478
8/1/202163211
9/1/20212314
10/1/202152336
11/1/20211247

 

OR

Add a new date column as follows: 

 

Date                             Value              New   Date          
1/01/202152451/01/2021
2/01/202132142/01/2021
3/01/202174583/01/2021
4/01/2021363144/01/2021
5/01/202154785/01/2021
 23146/1/2021
 54787/1/2021
 632118/1/2021
 23149/1/2021
 5233610/1/2021
 124711/1/2021

 

I did a lot of googling and spent a lot of time on this (almost half a day), but I couldn't find anything useful. And now the Power BI community is my only hope. Any help would be highly appreciated. 🙂

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , First add an index column in power query  https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

Post that in DAX create a new column

 

new date =
var _max = maxx(filter(Table, not(isblank([Date])), [index])
var _maxd = maxx(filter(Table, not(isblank([Date])), [Date])
return
if(not(isblank([Date])), [Date],_maxd + [Index]-_max)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , First add an index column in power query  https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

Post that in DAX create a new column

 

new date =
var _max = maxx(filter(Table, not(isblank([Date])), [index])
var _maxd = maxx(filter(Table, not(isblank([Date])), [Date])
return
if(not(isblank([Date])), [Date],_maxd + [Index]-_max)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

OMG, it works, I cannot thank you enough for this. Thank you so much! 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors