Forum Discussion
byr10112
Microsoft Employee
4 years agoCount Occurrence of Column Values in Another Table
This sounds like a pretty simple request, but I havent been able to find a solution yet. Maybe I'm still thinking from a t-SQL perspective. I'm trying to find how many times a value in a column ...
- 4 years ago
Measure = var _a = SELECTEDVALUE('Table A'[Skills Name]) var _b = HASONEVALUE('Table A'[Skills Name]) var _c = countrows( FILTER('Table B', 'Table B'[Skills Requested] = _a )) Return if (_b, if (ISBLANK(_c), 0, _c), BLANK() )Output:
sevenhills
Super User
4 years agoMeasure =
var _a = SELECTEDVALUE('Table A'[Skills Name])
var _b = HASONEVALUE('Table A'[Skills Name])
var _c = countrows( FILTER('Table B', 'Table B'[Skills Requested] = _a ))
Return
if (_b, if (ISBLANK(_c), 0, _c), BLANK() )
Output:
- byr101124 years ago
Microsoft Employee
Thanks for your reply. This measure returns the same number for every single entry. There are no blanks or 0s but there should be some.
- sevenhills4 years ago
Super User
Not clear what you are saying ... what exactly you need?
I took your input tables and created measue you want in output table and matched it.
- byr101124 years ago
Microsoft Employee
This measure returns 2663 for every single row in Table A, even if they do not exists in Table B. I don't know where 2663 is coming from. What you did makes sense to me but I don't know why it's not working in my report.
- meIdo3 years ago
Helper I
How do I create occurence column instead of measure?
- Anonymous2 years agoNot applicable
Hey, thanks for this!
Is there a way to do the same but as a column?