Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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