Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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
User | Count |
---|---|
106 | |
89 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |