ssasssas-tabularevaluatessas-2012

How to retrieve a measure from SSAS tabular project using DAX script in SSMS?


I have a tabular project with one fact table and few dimension tables.

The fact table Fact1 has a measure called Number_of_Children. How to retrieve that measure using EVALUATE statement is SSMS?

evaluate(values('Fact1 '[Number_of_Children]))

will not work


Solution

  • A query must result in a table with at least a single column and row for the evaluation, as opposed to the single value returned by the measure. The EVALUATE statement also doesn't need opening and closing parenthesis. Use the ROW function to create a table consisting of the single row returned by the measure.

    EVALUATE
    ROW ( "Number of Childern", 'Fact1 '[Number_of_Children])