Power BI: count occurrences

To count occurrences, I just need to include the FILTER and EARLIER functions with this formula:

FILTER('table',EARLIER('table'[argument])='table'[argument])

With another function. And if I need to calculate it based on criteria, I need to add another argument for each condition like that:

FILTER('table',EARLIER('table'[argument1])='table'[argument1] && EARLIER('table'[argument2])='table'[argument2])

For instance, I have this table:

power bi

For “column” I use this formula to count the number of occurrences for “support”:

COUNTX(first formula,'table'[argument])

power bi

For “column 2”, calculating it for each “number”:

COUNTX(second formula,'table'[argument2])

power bi

In both examples, I use the COUNTX function but I can get the same results by using the CALCULATE and COUNT functions:

CALCULATE(COUNT('table'[argument]),first formula or second formula)

Interesting Management