The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello,
I have the below sample dataset. I am trying to create a measure which gives the occurence of the attribute A but I only want A's occurence to be counted once per ID value.
For the sample dataset the measure should return a count of 3 (Once from ID=1, Once from ID=3 and Once from ID=4).
Any help would be much appreciated.
ID | Attribute |
1 | A |
1 | A |
1 | B |
2 | B |
2 | B |
3 | A |
3 | A |
3 | C |
4 | A |
Thanks,
Ali
Solved! Go to Solution.
Hi,
Write these measures
A count = CALCULATE(COUNTROWS(Data),Data[Attribute]="A")
Measure = COUNTROWS(FILTER(VALUES(Data[ID]),[A count]>0))
Hope this helps.
Hi,
Write these measures
A count = CALCULATE(COUNTROWS(Data),Data[Attribute]="A")
Measure = COUNTROWS(FILTER(VALUES(Data[ID]),[A count]>0))
Hope this helps.
You are welcome.
hi @aloosh89 ,
Are you trying to count the occurence fo each item in ID just once. If so, try this measure:
Count =
COUNTROWS ( SUMMARIZE ( 'Table', 'Table'[ID], 'Table'[Attribute] ) )
Is this what you are looking for?
Sample PBIX file attached
Counting occurence of attribute only once per ID.pbix
User | Count |
---|---|
65 | |
62 | |
60 | |
53 | |
28 |
User | Count |
---|---|
181 | |
82 | |
67 | |
48 | |
44 |