The syntax for 'SUMX' is incorrect

Jun 25, 2016 at 2:04 PM
Hi,

It must be a basic thing I am missing. I'd appreciate your insight.

When I type in the following query:
SUMX(FILTER(mrpt_timesheet, mrpt_timesheet[time_entry_start_date] > DATE(2016, 5, 1)), mrpt_timesheet[hours_logged])
I get the syntax error in the subject line...I dragged and dropped the table (name) and column names from the metadata just to make sure I don't have a typo.

thanks in advance,
Murat
Coordinator
Jun 27, 2016 at 8:46 PM
That is not a query, it's just a scalar expression. Queries in DAX need to use the EVALUATE keyword see https://msdn.microsoft.com/en-us/library/gg492201.aspx?f=255&MSPPError=-2147217396

If you want to get a single number returned you'd need to use the ROW() function to generate a single row table.

eg
EVALUATE
ROW( "Hours Logged" ,
  SUMX(FILTER(mrpt_timesheet, mrpt_timesheet[time_entry_start_date] > DATE(2016, 5, 1)), mrpt_timesheet[hours_logged])
)
There are some examples of various DAX Queries here https://www.simple-talk.com/sql/reporting-services/using-dax-to-retrieve-tabular-data/