Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have created a table in DAX as below:
Company Currency | Company Currency Amount | Item start | Item End |
EUR | 319282 | 1/1/2023 | 12/31/2023 |
… | … | … | … |
I want to expland each line of data into multiple lines based on the Item Start month and Item End month, so the first line of data should become 12 lines because the item start in 2023 Jan and ends in 2023 Dec. I would also like to restore the year month information in a new field called [Date Key] . How can I do this in DAX?
Company Currency | Company Currency Amount | Item start | Item End | Date Key |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 1/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 2/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 3/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 4/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 5/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 6/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 7/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 8/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 9/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 10/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 11/1/2023 |
EUR | 319282 | 1/1/2023 | 12/31/2023 | 12/1/2023 |
Solved! Go to Solution.
hi, @Jeanxyz
make a new table of date with start of every month
like below
then use below code
just adjust colum name and table name
result table =
GENERATE(
'Table',
FILTER(
'firstdate',
MONTH('firstdate'[date])>=MONTH('Table'[Item start])
&& MONTH('firstdate'[date])<=MONTH('Table'[Item End])
)
)
output like below
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
hi, @Jeanxyz
make a new table of date with start of every month
like below
then use below code
just adjust colum name and table name
result table =
GENERATE(
'Table',
FILTER(
'firstdate',
MONTH('firstdate'[date])>=MONTH('Table'[Item start])
&& MONTH('firstdate'[date])<=MONTH('Table'[Item End])
)
)
output like below
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly