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.
Can someone help me with a formula for a calculated column that makes it possible to show only records that have two items A and B within the same number?
Example data:
NR | Item |
1 | A |
1 | B |
2 | A |
3 | A |
3 | B |
4 | A |
5 | A |
5 | C |
THe result i'm looking for is:
NR | Item |
1 | A |
1 | B |
3 | A |
3 | B |
Solved! Go to Solution.
Here's a column expression that returns T/F for Numbers 1 and 3 rows.
ABonly =
VAR items =
CALCULATETABLE ( DISTINCT ( T1[Item] ), ALLEXCEPT ( T1, T1[NR] ) )
VAR AB = { "A", "B" }
RETURN
COUNTROWS ( INTERSECT ( items, AB ) ) = 2
&& COUNTROWS ( items ) = 2
Pat
Here's a column expression that returns T/F for Numbers 1 and 3 rows.
ABonly =
VAR items =
CALCULATETABLE ( DISTINCT ( T1[Item] ), ALLEXCEPT ( T1, T1[NR] ) )
VAR AB = { "A", "B" }
RETURN
COUNTROWS ( INTERSECT ( items, AB ) ) = 2
&& COUNTROWS ( items ) = 2
Pat
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 |
---|---|
65 | |
63 | |
52 | |
37 | |
36 |
User | Count |
---|---|
79 | |
67 | |
60 | |
45 | |
45 |