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 September 15. Request your voucher.

Reply
vijaykumarj19
Microsoft Employee
Microsoft Employee

Return value based on condition

IDTitleWork Item TypeHierarchy PathParent IDClosed Date 
7141Test --Epic7141   
7142F1Feature7141|71427141  
7143US-1User Story7141|7142|71437142  
7144A001- task us1Task7141|7142|7143|714471432/8/2020 
7145US-2User Story7141|7142|71457142  
7146B001 - check systemsTask7141|7142|7145|714671452/10/2020 
7147US-3User Story7141|7142|71477142  
7148C001 - testTask7141|7142|7147|714871473/9/2020 
7149C002 - test erpTask7141|7142|7147|714971473/10/2020 
7150C003 - test sqlTask7141|7142|7147|715071473/11/2020 
7151C004 - test serversTask7141|7142|7147|715171473/12/2020 
7152C005 - test osTask7141|7142|7147|71527147  
7153C006 - test networkTask7141|7142|7147|71537147  
7154C007 - offTask7141|7142|7147|71547147  
7155C008 - bugsTask7141|7142|7147|71557147  
       

 

 

 

 

I want to calculate  closed data of task (7151)< closed data (tasks before that particular tasks (7148,7149,7150)) 
>then it should return  good
> if any any date field in the tasks are null then also it should return good

1 ACCEPTED SOLUTION

@vijaykumarj19 , Try like this

new column = 
var _1 = countx(filter(table,[parent ID ] =earlier([parent ID ]) && [code] <earlier([code])),[ID] )
var _2 = countx(filter(table,[parent ID] =earlier([parent ID]) && [code] <earlier([code]) && [Closed Date	 ] <earlier([Closed Date	 ]) ),[ID] )
return 
if(_1 =_2 , "OK",blank())

 

Or with additional columns

//additional column
code = left([Title],len([Title])-1) // we can use parent ID 
sequence= right([Title])


new column = 
var _1 = countx(filter(table,[code] =earlier([code]) && [sequence] <earlier([sequence])),[ID] )
var _2 = countx(filter(table,[code] =earlier([code]) && [sequence] <earlier([sequence]) && [Closed Date	 ] <earlier([Closed Date	 ]) ),[ID] )
return 
if(_1 =_2 , "OK",blank())

 

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
amitchandak
Super User
Super User

@vijaykumarj19 , I am not able to logic, how do you get three are before 7151 not others?

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

In title there is a prefix C003,C002,C001 by using these need to compare C004(7151 prefix) 

@vijaykumarj19 , Try like this

new column = 
var _1 = countx(filter(table,[parent ID ] =earlier([parent ID ]) && [code] <earlier([code])),[ID] )
var _2 = countx(filter(table,[parent ID] =earlier([parent ID]) && [code] <earlier([code]) && [Closed Date	 ] <earlier([Closed Date	 ]) ),[ID] )
return 
if(_1 =_2 , "OK",blank())

 

Or with additional columns

//additional column
code = left([Title],len([Title])-1) // we can use parent ID 
sequence= right([Title])


new column = 
var _1 = countx(filter(table,[code] =earlier([code]) && [sequence] <earlier([sequence])),[ID] )
var _2 = countx(filter(table,[code] =earlier([code]) && [sequence] <earlier([sequence]) && [Closed Date	 ] <earlier([Closed Date	 ]) ),[ID] )
return 
if(_1 =_2 , "OK",blank())

 

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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