- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
New Column Based on Value from Two Existing Columns
I am trying to create a new column that takes into consideration values from two existing columns, the first column is a unique ID that is repeated multiple times and the second column is either a Yes or No value associated to the unique ID.
I want the new column to state "Yes" if a yes (column B) exist at any point for the rows associated to the unique ID (column A) and "No" if there are not any rows associated to the unique ID that state yes. Below is an example, I was having a hard time articulating this, hopefully, it makes sense.
Unique ID | Value | New Column |
AAAA1234 | No | Yes |
AAAA1234 | No | Yes |
AAAA1234 | No | Yes |
AAAA1234 | Yes | Yes |
BBBB1234 | No | No |
BBBB1234 | No | No |
BBBB1234 | No | No |
BBBB1234 | No | No |
CCCC1234 | Yes | Yes |
CCCC1234 | No | Yes |
CCCC1234 | No | Yes |
CCCC1234 | No | Yes |
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @kayjenki
Thank you for providing sample data.
To achieve the desired result, you can use the following formula to create a calculated column:
New Column - Calculated =
VAR _id = 'Table'[Unique ID]
VAR _values =
DISTINCT (
SELECTCOLUMNS (
FILTER (
ALL ( 'Table' ),
'Table'[Unique ID] = _id
),
[Value]
)
)
VAR _containsYesCount =
COUNTROWS (
FILTER (_values, CONTAINSSTRING ([Value], "Yes"))
)
RETURN
IF (_containsYesCount = 1, "Yes", "No")
Below is the screenshot of the result, allowing you to effortlessly compare the expected outcomes with the calculated ones:
I am also attachig the Power BI for your reference.
Best Regards,
Udit
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
✨ Visit My Linktree: LinkTree
Proud to be a SuperUser
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @kayjenki
Thank you for providing sample data.
To achieve the desired result, you can use the following formula to create a calculated column:
New Column - Calculated =
VAR _id = 'Table'[Unique ID]
VAR _values =
DISTINCT (
SELECTCOLUMNS (
FILTER (
ALL ( 'Table' ),
'Table'[Unique ID] = _id
),
[Value]
)
)
VAR _containsYesCount =
COUNTROWS (
FILTER (_values, CONTAINSSTRING ([Value], "Yes"))
)
RETURN
IF (_containsYesCount = 1, "Yes", "No")
Below is the screenshot of the result, allowing you to effortlessly compare the expected outcomes with the calculated ones:
I am also attachig the Power BI for your reference.
Best Regards,
Udit
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
✨ Visit My Linktree: LinkTree
Proud to be a SuperUser
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, that worked perfect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Happy to help 😊

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
06-19-2024 07:03 AM | |||
11-07-2023 08:29 PM | |||
05-29-2024 02:15 AM | |||
02-08-2024 06:17 AM | |||
Anonymous
| 06-07-2024 06:01 AM |
User | Count |
---|---|
24 | |
13 | |
11 | |
10 | |
9 |
User | Count |
---|---|
18 | |
14 | |
14 | |
12 | |
11 |