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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vijaykumarj19
Employee
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())

 

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?

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())

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors