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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Jeanxyz
Impactful Individual
Impactful Individual

how to expand a table in DAX

I have created a table in DAX as below: 

'test = summarize(filter('Fact_GL Entries','Fact_GL Entries'[Item start]>0), 'Fact_GL Entries'[Company Currency],'Fact_GL Entries'[Company Currency Amount],'Fact_GL Entries'[Item start],'Fact_GL Entries'[Item End])
 
The output will look like this. 
Company CurrencyCompany Currency AmountItem startItem End
EUR3192821/1/202312/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 CurrencyCompany Currency AmountItem startItem EndDate Key
EUR3192821/1/202312/31/20231/1/2023
EUR3192821/1/202312/31/20232/1/2023
EUR3192821/1/202312/31/20233/1/2023
EUR3192821/1/202312/31/20234/1/2023
EUR3192821/1/202312/31/20235/1/2023
EUR3192821/1/202312/31/20236/1/2023
EUR3192821/1/202312/31/20237/1/2023
EUR3192821/1/202312/31/20238/1/2023
EUR3192821/1/202312/31/20239/1/2023
EUR3192821/1/202312/31/202310/1/2023
EUR3192821/1/202312/31/202311/1/2023
EUR3192821/1/202312/31/202312/1/2023
1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

hi, @Jeanxyz 

 

make a new table of date with start of every month

like below

Dangar332_0-1710242895312.png

 

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

Dangar332_1-1710243141239.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
Dangar332
Super User
Super User

hi, @Jeanxyz 

 

make a new table of date with start of every month

like below

Dangar332_0-1710242895312.png

 

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

Dangar332_1-1710243141239.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.