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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

count of text

Hi all, 

 

I have just started using BI and DAX. 

 

I have a column with yes and no within, I am trying to get a count of the yes and no's  using the following formula added into a new column; 

 

CALCULATE ( COUNTROWS (#"Table 2"); #"Table 2"[Compliance] = "Yes" )

 

and its telling me a token comma expected?

 

Can anyone advise please?

 

 

3 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

It should be like

CALCULATE ( COUNTROWS ('#Table 2'), '#Table 2'[Compliance] = "Yes" )

Or

CALCULATE ( COUNTROWS ('#Table 2'); '#Table 2'[Compliance] = "Yes" )

 

But I will advise that you type formula and table and column names and there will be suggested list select from there.

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

Do yourself a favour and remove the # in the table names (you can rename them easily). Your code would be more readable.

Also: using a CALCULATE in a calculated column (rather than a measure) does not really make much sense - except in specific uses cases. CALCULATE modifies the filter context and as you are in a row context you don't generally modifiy the filter.

View solution in original post

dax
Community Support
Community Support

Hi @Anonymous , 

Yes, as I know, we usually use #'xxx' in M code, If you want to this in DAX, I think you should use 'Table' directly, you could enter the first character in expression, then it will automatically show table or column which you could choose from, tehn you could get correct  table or column name. 

In addition, as mentioned above, when you use English, you should use "," instead of ";" in expression.

=CALCULATE ( COUNTROWS ('Table 2'),Table 2[Compliance] = "Yes" )

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
dax
Community Support
Community Support

Hi @Anonymous , 

Yes, as I know, we usually use #'xxx' in M code, If you want to this in DAX, I think you should use 'Table' directly, you could enter the first character in expression, then it will automatically show table or column which you could choose from, tehn you could get correct  table or column name. 

In addition, as mentioned above, when you use English, you should use "," instead of ";" in expression.

=CALCULATE ( COUNTROWS ('Table 2'),Table 2[Compliance] = "Yes" )

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AilleryO
Memorable Member
Memorable Member

Hi,

 

If you are using PBI in english the separator in the formula shoudl the comme (,) and not semicolon (;).

 

Is it the solution ?

If yes mark it, otherwise please send a screenshot of your formula.

 

Have a nice day,

 

Anonymous
Not applicable

Do yourself a favour and remove the # in the table names (you can rename them easily). Your code would be more readable.

Also: using a CALCULATE in a calculated column (rather than a measure) does not really make much sense - except in specific uses cases. CALCULATE modifies the filter context and as you are in a row context you don't generally modifiy the filter.

amitchandak
Super User
Super User

It should be like

CALCULATE ( COUNTROWS ('#Table 2'), '#Table 2'[Compliance] = "Yes" )

Or

CALCULATE ( COUNTROWS ('#Table 2'); '#Table 2'[Compliance] = "Yes" )

 

But I will advise that you type formula and table and column names and there will be suggested list select from there.

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.