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
Anonymous
Not applicable

Creating custom column for each X return non-null value

Hi all,

 

 

I am looking at project management data from Microsoft Project Online (MSPO). I have 2 tables:

1) The project table: contains macro information for each project

2) The task table: contains information about the tasks that are contained in each project.  It looks as follow:

ProjectParent taskTaskDateLaunch date
Project 1GreenlightTask 1Dec 3 2018 
Project 1GreenlightTask 2Dec 10 2018 
Project 1ExecuteTask 1Jan 5 2018 
Project 1ExecuteExecute completeJan 10 2018Jan 10 2018
Project 1LaunchTask 1Jan 11 2018 
Project 1LaunchTask 2Feb 20 2018 

I have created the variable Task.Launch Date such as: 

Launch_Date = IF(AND(Tasks[ParentTaskName]="Execute",Tasks[TaskIsMilestone]=True),Tasks[TaskFinishDate],BLANK())
 

Key question: How do I create a LaunchDate variable on the project table which has the Task.Launch Date value when it is not null?

I have tried a LOOKUP (LOOKUPVALUE(Tasks[Launch_Date],Tasks[ProjectId],Projects[ProjectId])) and telling PowerBI to ignore blank values ALLNOBLANKROW(Tasks[Launch_Date]) but neither is working. I get the error "A table of multiple values was supplied where a single value was expected."

 

Any help would be greatly appreciated!

 
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @Anonymous

Projects table have a one-to-many relationship with tasks table, so in your calculation, it should returns multiple values

for each row although you had excluded null value, but if there are two or more Launch date,

which Launch date should be returned for the current row?

 

So you could use this formula to create a calculate column:

Column = CALCULATE(MAX(Tasks[Launch_Date]),FILTER(Tasks,Tasks[ProjectId]=Projects[ProjectId]))

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

HI, @Anonymous

Projects table have a one-to-many relationship with tasks table, so in your calculation, it should returns multiple values

for each row although you had excluded null value, but if there are two or more Launch date,

which Launch date should be returned for the current row?

 

So you could use this formula to create a calculate column:

Column = CALCULATE(MAX(Tasks[Launch_Date]),FILTER(Tasks,Tasks[ProjectId]=Projects[ProjectId]))

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

That worked perfectly, thank you for your help @v-lili6-msft!

 

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.