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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mdrammeh
Helper III
Helper III

How to create a calculated field by date interval

I need help creating a calculated field in Power BI or Power Query for the following measures:

 

Projects Submitted 27 months prior to “Constructions start” date”

Projects Released 21 months prior to “Construction Year”( Construction Year is 3 years from today's date)

Projects Scheduled between 12-18 months prior to “Construction Year”

Scheduled 1 Year Prior to “Construction Start”

 

Assuming I have the above field names to complete my calculations. Keep in mind that I want o use networking days only  if possible. 

 


Thanks for all your help in advance. 

 

Mustaff

2 ACCEPTED SOLUTIONS

You can do sth very similar in DAX with DATEADD, e.g.

 

DATEADD( TheData[Date], -27, MONTH )

 

 

- however your overall scenario is not very clear (to me) - do you e.g. want to count projects?

 

Frank

View solution in original post

Ya this formula should work in Power BI without any change dude.

 

lets see my example .

 

But u have to create  calculated column in table . see the picture 

1.JPG

 

 

2.JPG

 

 

 

let me know if it is not helping u , i will help u , to reach your goal

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

Can you provide some sample data and an explanation of "networking days"?

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

In Excel it would translate to something like this:

 

=DATE(YEAR(B33),MONTH(B33)+27,DAY(B33))

=DATE(YEAR(B33),MONTH(B33)-27,DAY(B33))

 

Timeline.PNGData.PNG

 

I tried to copy and paste the example but it didn't work. I hope this helps.

 

Ya this formula should work in Power BI without any change dude.

 

lets see my example .

 

But u have to create  calculated column in table . see the picture 

1.JPG

 

 

2.JPG

 

 

 

let me know if it is not helping u , i will help u , to reach your goal

Thanks! The formula works but what if I want to create a lookup by duration from each date within the same column? Let's say I have a columns A,B, and C as my example where:

 

Column "A" = Start date

Column "B" = Finish Date

Column "C" = Duration

 

1. How can I calculate the duration by month between "A" and "B" to produce the count of month for each project. 

2. After Calculating the Duration, how can I use this Excel formula to group by days:

E.G.

=IF([@[Duration]]<1,"Less than 1 day",IF(AND([@[Duration]]>0,[@[Duration]]<56),"Between 1 and 55 days",IF(AND([@[Duration]]>55,[@[Duration]]<366),"Between 56 and 365 days","Greater than 365 days")))

You can do sth very similar in DAX with DATEADD, e.g.

 

DATEADD( TheData[Date], -27, MONTH )

 

 

- however your overall scenario is not very clear (to me) - do you e.g. want to count projects?

 

Frank

Thanks! The formula works but what if I want to create a lookup by duration from each date within the same column? Let's say I have a columns A,B, and C as my example where:

 

Column "A" = Start date

Column "B" = Finish Date

Column "C" = Duration

 

1. How can I calculate the duration by month between "A" and "B" to produce the count of month for each project. 

2. After Calculating the Duration, how can I use this Excel formula to group by days:

E.G.

=IF([@[Duration]]<1,"Less than 1 day",IF(AND([@[Duration]]>0,[@[Duration]]<56),"Between 1 and 55 days",IF(AND([@[Duration]]>55,[@[Duration]]<366),"Between 56 and 365 days","Greater than 365 days")))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors