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.
Hello,
I would like to count the occurence of the value of attribute1 = 'A', for each unique ID. Please see below:
ID | Attribute 1 | Attribute 2 |
1 | A | Y |
1 | A | Z |
1 | B | W |
2 | B | W |
2 | C | W |
3 | A | W |
Essentially, the output I am looking for is a measure that counts these occurences of 'A'. So for ID=1, the measure should equal 2. For ID=2, the measure should equal 0. For ID=3, the measure should equal 1.
Thanks in advance.
Ali
Solved! Go to Solution.
@aloosh89 Try this
Measure =
COUNTX (
FILTER (
'Table',
'Table'[Attribute 1] = "A"
),
'Table'[ID]
) + 0
Or
Measure =
CALCULATE (
COUNT ( 'Table'[ID] ),
'Table'[Attribute 1] = "A"
) + 0
@aloosh89 Try this
Measure =
COUNTX (
FILTER (
'Table',
'Table'[Attribute 1] = "A"
),
'Table'[ID]
) + 0
Or
Measure =
CALCULATE (
COUNT ( 'Table'[ID] ),
'Table'[Attribute 1] = "A"
) + 0
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
96 | |
93 | |
82 | |
70 | |
64 |
User | Count |
---|---|
115 | |
105 | |
95 | |
79 | |
72 |