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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
machovamichaela
Regular Visitor

DirectQuery COUNTA

Hello, 

 

can you please give me an advice about DirectQuery functionality?

 

I have two tables. Table one is called Reports and second one is called Rates. Firstly I didn't need DirectQuery mode, so my solution was following: I created measure in table Rates that was defined like that: x=COUNTA(Reports[id]) and then I created column defined: CumulativeRate=DIVIDE(Rates[sum];Rates[x]). My problem cames up when I wanted to connect my DB as DirectQuery. I am getting an error "COUNTA is not supported in DirectQuery mode".

 

Can you please help me how can i figure this problem out? Are there an alternative DAX queries for getting same results but in DirectQuery mode?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @machovamichaela,

 

Based on test, it’s not supported to create calculate columns with COUNTA function in “direct query” mode, however you can use this function in a measure, it works on my side.(you should turn on it first)

 

Turn on the option:
Capture6.PNG 


Measure:
Count ID = COUNTA(Table_1[ID])

 

Capture4.PNG

 

Regards,
Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @machovamichaela,

 

Based on test, it’s not supported to create calculate columns with COUNTA function in “direct query” mode, however you can use this function in a measure, it works on my side.(you should turn on it first)

 

Turn on the option:
Capture6.PNG 


Measure:
Count ID = COUNTA(Table_1[ID])

 

Capture4.PNG

 

Regards,
Xiaoxin Sheng

Greg_Deckler
Community Champion
Community Champion

OK, I'll ask the dumb question, do you need to use COUNTA or can you just use COUNT? COUNT counts numeric values, COUNTA counts numeric, blank and text values.

 

This link might help, although it is for SQL Server 2016, not sure what SQL you have.

https://msdn.microsoft.com/library/mt723603(SQL.130).aspx

 

But, that might be one solution, upgrade to SQL Server 2016.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Well I need to use COUNTA function because ID's are strings. I also think that I can't count number of records on the level of DB because I apply some filters in dashboard and I need to know exact number of records that suit this filter. I have to calculate like this thus I need to know an arithmetic mean for every attribute (I use custom visualisation called HorizontalFunnel).

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.