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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
JustJan
Responsive Resident
Responsive Resident

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
JustJan
Responsive Resident
Responsive Resident

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 

JustJan
Responsive Resident
Responsive Resident

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

 @JustJan  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. 

JustJan
Responsive Resident
Responsive Resident

@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

@JustJan  Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors