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

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.

Reply
SMITHY10283
Regular Visitor

Create calculated column based on value in another column

Hi, I need help in creating a calculated column and don't know where to start. 

 

So I have a dataset with Portfolio, Project, Reporting Date, Status as columns. 

 

PortfolioProjectReporting DateStatusProgress
DataAAAA01 Apr 2022Started0
DataAAAA01 May 2022Completed1
DataAAAA01 June 2022On track0
DataAAAA01 July 2022Completed1
DataBBBB01 Apr 2022Completed0
DataBBBB01 May 2022Started0
DataBBBB01 June 2022Completed1
DataBBBB01 July 2022Completed

0

 

DivisonCCCC01 Apr 2022Completed0
DivisonCCCC01 May 2022Started0
DivisonCCCC01 June 2022Started0
DivisonCCCC01 July 2022Completed

2

 

 

What I want to calculate is the Progress column (expected output in red), which is how long it took the status to turn to Completed. For example for the first project, it went from started to completed after 1 month in May and July, and for the second project it went Completed after 1 month in June, and similarly it took 2 months for the status to go to Green for the 3rd project. 

For the second project, since the month after (July) was also "Completed", the progress remains at 0. 
Also for the month in Apr in the same project the status is "Completed" but since that is the first entry that is recorded, there is no other Completed status to compare to hence why it is 0. 

How would I do this?

1 ACCEPTED SOLUTION

@SMITHY10283 , Update one and file attached

    Progress1 = 
    var _min = Maxx(filter(Projects, Projects[project] = earlier(Projects[Project]) && Projects[Status] = "Completed" && [Reporting Date] < earlier([Reporting Date])) , [Reporting Date])
    var _min1 = if(ISBLANK(_min) , minx(filter(Projects, Projects[project] = earlier(Projects[Project])  && [Reporting Date] < earlier([Reporting Date])) , [Reporting Date]) , minx(filter(Projects, Projects[project] = earlier(Projects[Project])  && [Reporting Date] >_min && [Reporting Date] < earlier([Reporting Date])) , [Reporting Date]))
    return
    if(Projects[Status] = "Completed", DATEDIFF(_min1, [Reporting Date], MONTH),0
    )
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

3 REPLIES 3
SMITHY10283
Regular Visitor

Sorry didn't work, I have edited my original post

@SMITHY10283 , Update one and file attached

    Progress1 = 
    var _min = Maxx(filter(Projects, Projects[project] = earlier(Projects[Project]) && Projects[Status] = "Completed" && [Reporting Date] < earlier([Reporting Date])) , [Reporting Date])
    var _min1 = if(ISBLANK(_min) , minx(filter(Projects, Projects[project] = earlier(Projects[Project])  && [Reporting Date] < earlier([Reporting Date])) , [Reporting Date]) , minx(filter(Projects, Projects[project] = earlier(Projects[Project])  && [Reporting Date] >_min && [Reporting Date] < earlier([Reporting Date])) , [Reporting Date]))
    return
    if(Projects[Status] = "Completed", DATEDIFF(_min1, [Reporting Date], MONTH),0
    )
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
amitchandak
Super User
Super User

@SMITHY10283 , Try a measure like

new column =

var _min = minx(filter(Table, Table[project] = earlier(Table[Project]) && Table[Status] = "Completed") , [Reporting Date])

return

if([reporting Date] =_min, 1, 0)

 

Power BI DAX- Earlier, I should have known Earlier: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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