Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
EthEl_2426
New Member

Counting number of occurences in a column using countrows

Hello, I have got a column showing status of deals i.e. Oplen, Lost and Won. I would like to use dax syntax to get the value under a measure. The code below i have used is retuning an error message "Too few arguments were passed to the CONTAINS function. The minimum argument count for the function is 3."

 

Lost Deals =
//Calculates the number of rows with data set to "Lost"
COUNTROWS(FILTER('Pipeline', CONTAINS('Pipeline'[Status], "Lost")))
 EthEl_2426_1-1677564534759.png

 

EthEl_2426_0-1677564468857.png

 

Thank you in advance.

1 ACCEPTED SOLUTION
Arul
Super User
Super User

@EthEl_2426 ,

try this,

 

Count of Status Lost = 
CALCULATE(COUNTROWS('Table'),'Table'[Status] = "Lost")

Result:

Arul_0-1677577403898.png

 

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

You need the table as the first argument to CONTAINS

Lost deals =
COUNTROWS (
    FILTER ( 'Pipeline', CONTAINS ( 'Pipeline', 'Pipeline'[Status], "Lost" ) )
)
Arul
Super User
Super User

@EthEl_2426 ,

try this,

 

Count of Status Lost = 
CALCULATE(COUNTROWS('Table'),'Table'[Status] = "Lost")

Result:

Arul_0-1677577403898.png

 

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.