Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I want to create a new column that classifies IDs based on whether they are seen in combination with another specific value.
I have tried with IF, IF contains and look-up functions but with no luck. I just get a replication or count of 'SomeValue'. What I want is to set 'Y' or '1' in the new column whenever an ID has 'X' in SomeValue no matter the frequency.
The HasX should be the desired outcome as shown below
ID | SomeValue | HasX? |
1 | Y | |
1 | X | Y |
1 | Y | |
2 | Y | |
2 | X | Y |
3 | N | |
4 | N | |
4 | N |
Solved! Go to Solution.
Hi,
try this:
hi @Walid_Abou
try to add a column like:
Column =
VAR _list =
CALCULATETABLE(
VALUES(data[SomeValue]),
data[ID]=EARLIER(data[ID])
)
RETURN
IF(
"X" IN _list,
"Y", "N"
)
it worked like:
Hi,
try this:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
7 | |
6 | |
5 |
User | Count |
---|---|
20 | |
11 | |
10 | |
9 | |
6 |