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:
For “column” I use this formula to count the number of occurrences for “support”:
COUNTX(first formula,'table'[argument])
For “column 2”, calculating it for each “number”:
COUNTX(second formula,'table'[argument2])
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 Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...