Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all, and apologies if this is the wrong forum for this.
I'm trying to connect to a local analysis services instance using ADOMD.NET. Querying for tabular data works with no problems, but I'd like to be able to execute measures stored in the model and retrieve the result.
I've tried many different variations over the same theme, but the code below represents the essentials. Trying any measure using this code will result in a generic error telling me that the "Specified method is not supported." As far as I can tell this will happen on the executeScalar call regardless of what DAX code I pass to it.
Am I doing something fundamentally wrong here, or is this a limitation of ADOMD.NET? If so, is there a way to execute DAX on the model using another framework?
using (var connection = new AdomdConnection(_connectionString))
{
connection.Open();
AdomdCommand cmd = new AdomdCommand(query);
cmd.Connection = connection;
cmd.ExecuteScalar();
data = (string)cmd.ExecuteScalar();
}
Solved! Go to Solution.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
4 | |
4 | |
3 | |
3 | |
2 |