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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

New Column for Matching Column 2 to Column 1

Column 1 (Project ID) contains repeating values.

Column 2 contains a series of values, maximum of 1 of each per project ID (column 1). 

 

I want to add a new column that adds value of "Canceled" whenever column 2 contains "Canceled", but to mark that for all rows where Project ID matches.

 

Example from screenshot below:

Project ID: 64f1de08076108cf4638f61b4def8bdb 
Print Statuses: Sent to print, Not submitted, Printing, Shipped, Canceled

 

Since this Project ID has Print Status of "canceled", I want to mark all rows with 64f1de08076108cf4638f61b4def8bdb as "Canceled" in a new column. 

 

Alternatively,

Project ID: 64f9d23a01d07f63c698ec40de8e9f51 does NOT have the print status of "canceled", so the new column would be blank for all rows of this Project ID. 

 

anwessel_0-1709924277657.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Thank you @HotChilli  for the quick response and solution. Here are some of my additions:
According to your first description, you can create such a calculated column:

Column 1 = 
var _a=COUNTAX(FILTER('Table','Table'[project id]=EARLIER('Table'[project id]) && 'Table'[print status]="canceled"),[project id])
RETURN IF(_a>0,"canceled",[print status])

Based on your second description, you can create a calculated column like this:

Column 2 = 
 var _a=COUNTAX(FILTER('Table','Table'[project id]=EARLIER('Table'[project id]) && 'Table'[print status]="canceled"),[project id])
RETURN IF(_a=BLANK(),BLANK(),[print status])

Then the result is as follows.

vtangjiemsft_0-1710138605292.png

 

Best Regards,

Neeko Tang

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Thank you @HotChilli  for the quick response and solution. Here are some of my additions:
According to your first description, you can create such a calculated column:

Column 1 = 
var _a=COUNTAX(FILTER('Table','Table'[project id]=EARLIER('Table'[project id]) && 'Table'[print status]="canceled"),[project id])
RETURN IF(_a>0,"canceled",[print status])

Based on your second description, you can create a calculated column like this:

Column 2 = 
 var _a=COUNTAX(FILTER('Table','Table'[project id]=EARLIER('Table'[project id]) && 'Table'[print status]="canceled"),[project id])
RETURN IF(_a=BLANK(),BLANK(),[print status])

Then the result is as follows.

vtangjiemsft_0-1710138605292.png

 

Best Regards,

Neeko Tang

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

Anonymous
Not applicable

Thank you, @Anonymous! Your column 1 calculation works great! This will get me where I need to go. 

HotChilli
Super User
Super User

Create a calculated column.

Count the rows which have the same projectID as the current row with Print Status = "Canceled"

, for example,

var _Pid = theTable[Project ID]
var _CanceledRow = COUNTROWS(FILTER(theTable, theTable[Project ID] = _Pid && theTable[Print Status] = "Canceled"))

this should put 0 or 1 in _CanceledRow.

Write an IF statement that tests the value of _CanceledRow.  If greater than 0 then "Canceled"

lbendlin
Super User
Super User

Please provide sample data in usable format (not as a screenshot).

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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