Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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/2021 | 5245 |
2/01/2021 | 3214 |
3/01/2021 | 7458 |
4/01/2021 | 36314 |
5/01/2021 | 5478 |
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/2021 | 5245 |
2/01/2021 | 3214 |
3/01/2021 | 7458 |
4/01/2021 | 36314 |
5/01/2021 | 5478 |
6/1/2021 | 2314 |
7/1/2021 | 5478 |
8/1/2021 | 63211 |
9/1/2021 | 2314 |
10/1/2021 | 52336 |
11/1/2021 | 1247 |
OR
Add a new date column as follows:
Date | Value | New Date |
1/01/2021 | 5245 | 1/01/2021 |
2/01/2021 | 3214 | 2/01/2021 |
3/01/2021 | 7458 | 3/01/2021 |
4/01/2021 | 36314 | 4/01/2021 |
5/01/2021 | 5478 | 5/01/2021 |
2314 | 6/1/2021 | |
5478 | 7/1/2021 | |
63211 | 8/1/2021 | |
2314 | 9/1/2021 | |
52336 | 10/1/2021 | |
1247 | 11/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. 🙂
Solved! Go to Solution.
@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)
@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)
OMG, it works, I cannot thank you enough for this. Thank you so much!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |