COUNT FUNCTION DAX

The COUNT function is a power bi DAX statistical function which counts the number of rows in a table.





It returns a single integer value.

It ignores blank values in counting, allows only values of data types : String, Number and dates.

It does not support Boolean values (TRUE/FALSE).

The only argument allowed to this function is a column.

DAX SYNTAX

COUNT(<column>)

<column> is the column that contains the values to be counted.

Lets go through an example to see COUNT() Function in action.

Here we have a sample table which consist a registration data of students

Lets create a measure which use the count() function and returns total rows counts.

Count_Rows = Count(Registration[ID])

You can see, the measure output by dragging it into card visual that is 10.

 

Count() Function does not support boolean(TRUE/FALSE) values 

To demonstrate this, Lets use Count() Function to count the Boolean values.

Here we have boolean column named as Flag, Lets see count () function with boolean column.

Count_boolean = COUNT(Registration[Flag])

Once you drag this measure to card visual, It gives an error as shown in below screenshot.




SQL Basics TutorialSQL Advance TutorialSSRSInterview Q & A
SQL Create tableSQL Server Stored ProcedureCreate a New SSRS Project List Of SQL Server basics to Advance Level Interview Q & A
SQL ALTER TABLESQL Server MergeCreate a Shared Data Source in SSRSSQL Server Question & Answer Quiz
SQL DropSQL Server PivotCreate a SSRS Tabular Report / Detail Report
..... More.... More....More
Power BI TutorialAzure TutorialPython TutorialSQL Server Tips & Tricks
Download and Install Power BI DesktopCreate an Azure storage accountLearn Python & ML Step by stepEnable Dark theme in SQL Server Management studio
Connect Power BI to SQL ServerUpload files to Azure storage containerSQL Server Template Explorer
Create Report ToolTip Pages in Power BICreate Azure SQL Database ServerDisplaying line numbers in Query Editor Window
....More....More....More




 184 total views,  1 views today

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.