Forum Discussion
Can't read scalar values using ADOMD.NET in Analysis Services/Power BI model
- 5 years ago
Sorry, this is not a good solution as it runs SQL instead of DAX. I did find a workaround by wrapping measure-DAX in a ROW()-call so that the data would be returned as a table with one row.
HI chrisha,
According to your description, I think you are working with the c# programming language and try to connect the AS data source with a custom command.
If that is the case, I think you need to use the t-SQL query instead of the DAX query which you used in the connection. (As the document mention, SQL command not supported DAX expression)
SqlCommand.ExecuteScalar Method
using (var connection = new AdomdConnection(_connectionString))
{
connection.Open();
string query="SELECT * FROM TABLE";
AdomdCommand cmd = new AdomdCommand(query);
cmd.Connection = connection;
cmd.ExecuteScalar();
data = (string)cmd.ExecuteScalar();
}
Regards,
Xiaoxin Sheng
Sorry, this is not a good solution as it runs SQL instead of DAX. I did find a workaround by wrapping measure-DAX in a ROW()-call so that the data would be returned as a table with one row.