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
Anonymous
Not applicable

For each month within a timespan create a new entry in an new table

Hi. I defently need some help, after searching some hours for a solution by myself.

 

For example, if I start with this table which could be the startdate and enddate of an contract:

 

idstartend
11/1/20203/31/2020
22/1/20204/30/2020

 

I am looking for a table, which tells me for each month that the contract is still running.

 

idtime_point
11/1/2020
12/1/2020
13/1/2020
22/1/2020
23/1/2020
24/1/2020

 

With this table , I would be able to make a view how many contracts are running each month.

 

Thanks everybody!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, thanks for staying.

 

I finnaly found a solution by myself. I did is this way. I 

 

This was the starting point

= Table.AddColumn(ET_Contract_Generation_Asset__c, "Duration_Days", each List.Dates(DateTime.Date([Start_Date__c]),Duration.Days(DateTime.Date([End_Date__c]) -DateTime.Date([Start_Date__c])), #duration(1,0,0,0)))

 

Transform all dates to the first


Table.AddColumn(#"Hinzugefügte benutzerdefinierte Spalte", "Duration_Days_First_Of_Month", each List.Transform([Duration_Days],each Date.StartOfMonth(_)))

 

 

Delete Duplicates

 


Table.AddColumn(#"Hinzugefügte benutzerdefinierte Spalte1", "Duration_Months", each List.Distinct([Duration_Days_First_Of_Month]))

 

This way the memory and calucation isn't collapsing.

 

Many thanks

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi, thanks for staying.

 

I finnaly found a solution by myself. I did is this way. I 

 

This was the starting point

= Table.AddColumn(ET_Contract_Generation_Asset__c, "Duration_Days", each List.Dates(DateTime.Date([Start_Date__c]),Duration.Days(DateTime.Date([End_Date__c]) -DateTime.Date([Start_Date__c])), #duration(1,0,0,0)))

 

Transform all dates to the first


Table.AddColumn(#"Hinzugefügte benutzerdefinierte Spalte", "Duration_Days_First_Of_Month", each List.Transform([Duration_Days],each Date.StartOfMonth(_)))

 

 

Delete Duplicates

 


Table.AddColumn(#"Hinzugefügte benutzerdefinierte Spalte1", "Duration_Months", each List.Distinct([Duration_Days_First_Of_Month]))

 

This way the memory and calucation isn't collapsing.

 

Many thanks

Anonymous
Not applicable

Hi @Anonymous ,

I have create a simple sample , please refer to it to see if it helps you.

Add a custom column in Power Query.

List.Dates(DateTime.Date([start]),Duration.Days(DateTime.Date([end]) -DateTime.Date([start])), #duration(1,0,0,0))

Then expand the custom column.

Finally create a measure.

Measure =
VAR _year =
    YEAR ( MAX ( 'Table'[Custom] ) )
VAR _month =
    MONTH ( MAX ( 'Table'[Custom] ) )
RETURN
    IF (
        MAX ( 'Table'[Custom] ) = DATE ( _year, _month, 1 ),
        MAX ( 'Table'[Custom] ),
        BLANK ()
    )

vpollymsft_0-1662950895016.png

Best Regards

Community Support Team _ Polly

 

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

Anonymous
Not applicable

Great Polly, this works very well so far.

 

However, by this way a recieve a table with millons of entries in the first step, because each day is an entry.

 

With the second step, we eliminate those millions by filtering only the month's first.

 

Is there an alternative way to filter them in the first place before creating a table. This way consumes a lot space and calucation time.

 

Many thanks!

Anonymous
Not applicable

Hi @Anonymous ,

What is your meaning? Could you please provide a simple like the above? Or some screenshots.

 

Best Regards

Community Support Team _ Polly

 

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 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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