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
YonaD
Frequent Visitor

Calculated Column or New measure

Hello Everyone,

I am new to power BI and DAX and I was trying to create a calculated column in which the values depend on the calculation from another table.

My data look like these:

Table 1

Project IDProject NameActivityStart DateFinish Date
1Project ATask 12020-01-15 
1Project ATask 2 2020-01-31
2Project BTask 12021-03-19 
2Project BTask 2 2021-12-11
3Project CTask 12022-01-09 
3Project CTask 2 2022-01-31

 

Table 2

Project IDProject NameActivityDuration
1Project ATask 2 
2Project BTask 2 
3Project CTask 2 

 

I was trying to create that Duration column which is the datediff of task 1 start date and task 2 finish date. Could anyone please help me solve this? I tried calculated column but I am getting one same answer for all. Thank you in advanced.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@YonaD , a new column

 

new column in table 2 =
datediff(minx(filter(Table1, Table1[Project ID] = Table2[Project ID] && Table1[Activity] ="Task 1"),Table1[Start Date]),
maxx(filter(Table1, Table1[Project ID] = Table2[Project ID] && Table1[Activity] ="Task 2"),Table1[Finish Date]),day)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@YonaD , a new column

 

new column in table 2 =
datediff(minx(filter(Table1, Table1[Project ID] = Table2[Project ID] && Table1[Activity] ="Task 1"),Table1[Start Date]),
maxx(filter(Table1, Table1[Project ID] = Table2[Project ID] && Table1[Activity] ="Task 2"),Table1[Finish Date]),day)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you so much!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.