Search code examples
daxrowcountdaxstudio

How to get table rowcount in DAX Studio


I'm trying to compare the column count of two tables, one in SSMS and one in DAX Studio, but I've never worked with DAX or Dax Studio before.

In SSMS, I ran SELECT COUNT(*) FROM MyTable to see the rowcount.

In DAX Studio, I ran COUNTROWS(MyTable) but it produced this error:

The syntax for '<pii>COUNTROWS</pii>' is incorrect.

I know there's probably something I need to add to make a valid query but can't find it. How can I query the row number of a table?


Solution

  • Youre using dax studio. it can only return table expressions So you need to create a table in your dax expression.

    like this :

    EVALUATE
    ROW("RowCount", COUNTROWS(MyTable))