Forum Discussion
Anonymous
7 years agoNot applicable
Countif in DAX or Power Query
Hi all, Please help as i was not able to find solution for what i require. I have dataset with repeating ID number and i need to count how many times it repeats in a dataset. Groupby does not wo...
- 7 years ago
If all you need is a measure for a card that displays the count of IDs that appear 2+ times, that should be pretty easy. I'm not sure why you're so against using summarization or groupings for a single measure, but here's how I would do it:
CountMultiIDs = COUNTROWS(FILTER(ADDCOLUMNS( VALUES('Table'[ID]), "IDCount", CALCULATE(COUNTROWS('Table'))), [IDCount]>1))The tricky bit here is to use CALCULATE around the inner COUNTROWS so that the DAX re-evaluates the context at which it is counting.
sktneer
7 years agoResolver I
How about this?
= CALCULATE( COUNT(Table1[ID]), FILTER(Table1, Table1[ID] = EARLIER(Table1[ID]) ) )
Anonymous
7 years agoNot applicable
I tried using this, but for some reason, EARLIER does not recognise any column name.
- sktneer7 years agoResolver I
That's something strange.
This is the output returned by that formula....