Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

SELECTEDVALUE() function not recognized

I'm trying to create a measure that grabs last year's sales so that I can compare them to this year's sales.

 

It is saying that the SELECTEDVALUE() is not recognized.

"The report measure FactSalesOrderDetail[Previous Yr Sales] has a syntax or semantic error at line 4, position 36, reported by Analysis Services: 'Failed to resolve name 'SELECTEDVALUE'.  It is not a valid table or function name.

 

Previous Yr Sales = CALCULATE(
	SUM(FactSalesOrderDetail[InvoiceQuantity]),
	FILTER(ALL(ActualDeliveryDate),
		ActualDeliveryDate[FiscalYear] = SELECTEDVALUE(ActualDeliveryDate[FiscalYear]) - 1 
		)
		)

Has anyone encountered this before?

  • parry2k's avatar
    parry2k
    7 years ago

    Anonymous instead of selectedvalue , replace it with min or max function.

7 Replies

  • Anonymous what is your data source? How you are connected?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Get Data -> Analysis Services -> type in database

      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        Anonymous seems like you are using direct query to connect to Analysis service, read this post to understand what DAX functions are allow/optimized when direct query mode is used.