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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

The expression specified in the query is not a valid table expression

Hi, please I am using table variable and when i call the table name "evaluate tbl "with evaluate it works but when I use it in the context of countrows it returns the error above

*

DEFINE
VAR fsumX =
SUMMARIZE(CHA,[Employee],[YearNo],[Organisation],[MonthNamed],
"CallTimeDuration",SUM(CHA[CallTimeDuration])
)
VAR tbl =
FILTER(
fsumX, 
[AvgDBanding] = "Less Than 60 Min(s)" && CHA,[Organisation] = "b" && CHA,[MonthNamed] ="November"
          )

EVALUATE

COUNTROWS(tbl)
//tbl

*

I saw a similar solution that works with countrows (https://social.msdn.microsoft.com/Forums/sqlserver/en-US/42325576-064d-4fbf-bc1c-12fbd6c89728/dax-co...) but i could not get the quey for mine.

I will appreciate a guide on this

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Sorry, I thought your problem was in PBI.

 

In Dax Studio you need to use the following to check the result of a measure:

return
ROW("Result:", COUNTROWS(tbl))


 

 

 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi, 

 

When I try to run the code I get an error on [AvgDBanding] does not exist. 

When you add [AvgDBanding] to the FsumX / Summarize function then it will probably work.

It does work for me either as a calculated table or as a measure (with countrows, of course), but I tested it with a very simple test set.

Regards,

 

2020-01-04 11_33_26-sample tables - Power BI Desktop.jpg

 

 

 

Anonymous
Not applicable

Thanks for the response, the  return works well for me as well, but the "countrows" function on the tbl does not work, I was using the code in dax studio and it was throwing the error, but when I executed the code (countrows)in on power bi it worked, so I am guessing am missing something 

Anonymous
Not applicable

Sorry, I thought your problem was in PBI.

 

In Dax Studio you need to use the following to check the result of a measure:

return
ROW("Result:", COUNTROWS(tbl))


 

 

 

Thanks - this solution definitely worked!

Anonymous
Not applicable

 @Anonymous  Thanks for the solution, I had a look at the help of dax studio for "row" context but could not find it , can you send me on a link where i can see more on it. 

Anonymous
Not applicable

@Anonymous 

There is not too much explanation in the documentation, but it is a starting point:  https://docs.microsoft.com/en-us/dax/row-function-dax

Hope this helps.

 

Anonymous
Not applicable

@Anonymous  Thanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.