A
C
- CALCULATE
- CALCULATETABLE
- CALENDAR
- CALENDARAUTO
- CEILING
- CHISQ.DIST
- CHISQ.DIST.RT
- CHISQ.INV
- CHISQ.INV.RT
- CLOSINGBALANCEMONTH
- CLOSINGBALANCEQUARTER
- CLOSINGBALANCEYEAR
- COALESCE
- COLUMNSTATISTICS
- COMBIN
- COMBINA
- COMBINEVALUES
- CONCATENATE
- CONCATENATEX
- CONFIDENCE.NORM
- CONFIDENCE.T
- CONTAINS
- CONTAINSROW
- CONTAINSSTRING
- CONTAINSSTRINGEXACT
- CONVERT
- COS
- COSH
- COT
- COTH
- COUNT
- COUNTA
- COUNTAX
- COUNTBLANK
- COUNTROWS
- COUNTX
- COUPDAYBS
- COUPDAYS
- COUPDAYSNC
- COUPNCD
- COUPNUM
- COUPPCD
- CROSSFILTER
- CROSSJOIN
- CUMIPMT
- CUMPRINC
- CURRENCY
- CURRENTGROUP
- CUSTOMDATA
D
E
I
N
O
P
R
S
- SAMEPERIODLASTYEAR
- SAMPLE
- SEARCH
- SECOND
- SELECTCOLUMNS
- SELECTEDMEASURE
- SELECTEDMEASUREFORMATSTRING
- SELECTEDMEASURENAME
- SELECTEDVALUE
- SIGN
- SIN
- SINH
- SLN
- SQRT
- SQRTPI
- STARTOFMONTH
- STARTOFQUARTER
- STARTOFYEAR
- STDEVX.P
- STDEVX.S
- STDEV.P
- STDEV.S
- SUBSTITUTE
- SUBSTITUTEWITHINDEX
- SUM
- SUMMARIZE
- SUMMARIZECOLUMNS
- SUMX
- SWITCH
- SYD
T
U
Syntax of COUNTAX function
Before we dive into the usage of COUNTAX function in Power BI, let’s take a look at the syntax of the function. The syntax of the COUNTAX function is as follows:
COUNTAX(Table, Expression)
- Table: It is a required parameter that specifies the table or column to be evaluated.
- Expression: It is a required parameter that specifies the expression to be evaluated for each row in the specified table or column.
Usage of COUNTAX function in Power BI
Now that we have seen the syntax of the COUNTAX function, let's look at how to use it in Power BI. The COUNTAX function is used in measures in Power BI. Measures are calculations that are performed on the data model and are used to create visualizations in Power BI.
To use the COUNTAX function, follow these steps:
1. Open the Power BI Desktop application and connect to your data source.
2. Once you have imported the necessary data, click on the 'New Measure' button under the 'Modeling' tab.
3. In the formula bar that appears, type the following:
Measure Name = COUNTAX(Table, Expression)
Replace 'Measure Name' with a name that you want to give to your measure. Replace 'Table' with the name of the table or column that you want to evaluate. Replace 'Expression' with the expression that you want to evaluate for each row in the specified table or column.
4. Press Enter to create the measure.
5. Once you have created the measure, you can use it in visualizations in your report.
Examples of COUNTAX function usage in Power BI
Let's look at some examples of how to use the COUNTAX function in Power BI.
Example 1: Count the number of products in a table
Suppose you have a table called 'Products' that contains a list of products. You want to count the number of products in the table. To do this, you can create a measure using the COUNTAX function as follows:
Product Count = COUNTAX(Products, Products[Product Name])
This will count the number of rows in the 'Product Name' column of the 'Products' table that contain a non-blank value.
Example 2: Count the number of sales in a table
Suppose you have a table called 'Sales' that contains a list of sales. You want to count the number of sales in the table. To do this, you can create a measure using the COUNTAX function as follows:
Sales Count = COUNTAX(Sales, Sales[Sales Amount])
This will count the number of rows in the 'Sales Amount' column of the 'Sales' table that contain a non-blank value.
The COUNTAX function is a powerful DAX function that can be used to count the number of rows in a table that contain a non-blank value in a specified column. In this article, we looked at the syntax of the COUNTAX function, how to use it in Power BI, and some examples of its usage. By using the COUNTAX function in measures, you can create powerful visualizations that help you make informed business decisions.