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.
I have a data in which it'll only be for 4 months i need to reprint that values in the new column.for an example i have data in april'23 i nned to print the data for dec'22 to marc'23 . I have an sample I have provide two table Table 1 and 2. Table one is the i have and table is the desired output.
table 1 | |
date | value |
Apr-22 | 5 |
Jun-22 | 7 |
Oct-22 | 4 |
Dec-22 | 3 |
Apr-23 | 2 |
Jun-23 | 8 |
Oct-23 | 9 |
Dec-23 | 7 |
table 2 | |
date | value |
Dec-21 | 5 |
Jan-22 | 5 |
Feb-22 | 5 |
Mar-22 | 5 |
Apr-22 | 7 |
May-22 | 7 |
Jun-22 | 4 |
Jul-22 | 4 |
Aug-22 | 4 |
Sep-22 | 4 |
Oct-22 | 3 |
Nov-22 | 3 |
Dec-22 | 2 |
Jan-23 | 2 |
Feb-23 | 2 |
Mar-23 | 2 |
Apr-23 | 8 |
May-23 | 8 |
Jun-23 | 9 |
Jul-23 | 9 |
Aug-23 | 9 |
Sep-23 | 9 |
Oct-23 | 7 |
Nov-23 | 7 |
Dec-23 |
Solved! Go to Solution.
Hello @Anonymus_18
output :
steps :
step 1 :
adding 2 columns to original table :
COLUMN1
Column =
SELECTCOLUMNS(
OFFSET(
1,
SUMMARIZE(
date_sol,
date_sol[date],
date_sol[value]
),
ORDERBY(date_sol[date], asc)
),
date_sol[value]
)
COLUMN2
next ddate =
var t =
SELECTCOLUMNS(
OFFSET(
1,
SUMMARIZE(
date_sol,
date_sol[date],
date_sol[value]
),
ORDERBY(date_sol[date], asc)
),
date_sol[date]
)
return
t
step2 :
create the table :
Table_new =
var datasource =
FILTER(
SELECTCOLUMNS(
date_sol,
"date1",date_sol[date],
"value", date_sol[value],
"new_value",date_sol[Column],
"nextdate", edate(date_sol[next ddate],-1)
),
not isblank([nextdate])
)
var added_row =
DATATABLE(
"date1" , DATETIME,
"value", INTEGER,
"new_value", INTEGER,
"nextdate", DATETIME,
{
{"2021-12-01",0,5, "2022-03-01"}
}
)
var full_table =
UNION(
added_row,
datasource
)
var res =
SELECTCOLUMNS(
GENERATE(
full_table,
var d1 = [date1]
var d2 = [nextdate]
return
CALENDAR(d1,d2)
),
"newvalue",[new_value],
"dategenerated",[Date]
)
return
FILTER(
res,
DAY([dategenerated]) = 1
)
you can modify, the code as per your convenience.
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
Hello @Anonymus_18
output :
steps :
step 1 :
adding 2 columns to original table :
COLUMN1
Column =
SELECTCOLUMNS(
OFFSET(
1,
SUMMARIZE(
date_sol,
date_sol[date],
date_sol[value]
),
ORDERBY(date_sol[date], asc)
),
date_sol[value]
)
COLUMN2
next ddate =
var t =
SELECTCOLUMNS(
OFFSET(
1,
SUMMARIZE(
date_sol,
date_sol[date],
date_sol[value]
),
ORDERBY(date_sol[date], asc)
),
date_sol[date]
)
return
t
step2 :
create the table :
Table_new =
var datasource =
FILTER(
SELECTCOLUMNS(
date_sol,
"date1",date_sol[date],
"value", date_sol[value],
"new_value",date_sol[Column],
"nextdate", edate(date_sol[next ddate],-1)
),
not isblank([nextdate])
)
var added_row =
DATATABLE(
"date1" , DATETIME,
"value", INTEGER,
"new_value", INTEGER,
"nextdate", DATETIME,
{
{"2021-12-01",0,5, "2022-03-01"}
}
)
var full_table =
UNION(
added_row,
datasource
)
var res =
SELECTCOLUMNS(
GENERATE(
full_table,
var d1 = [date1]
var d2 = [nextdate]
return
CALENDAR(d1,d2)
),
"newvalue",[new_value],
"dategenerated",[Date]
)
return
FILTER(
res,
DAY([dategenerated]) = 1
)
you can modify, the code as per your convenience.
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
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 |
---|---|
105 | |
101 | |
79 | |
73 | |
65 |
User | Count |
---|---|
141 | |
107 | |
100 | |
82 | |
74 |