How do I execute parameterized DAX queries with dapper?

537 Views Asked by At

I want to execute DAX queries that have dynamic parameters with Dapper over ADOMD.NET? Is it possible? I understand that I have to use DynamicParameters. My question is about whether Dapper supports parameterized DAX queries.

EDIT:

My query looks like:

"DEFINE VAR __DS0FilterTable1 = FILTER(KEEPFILTERS(VALUES('Calendar'[Last 12 Months Indicator])), ('Calendar'[Last 12 Months Indicator] = @P0)) EVALUATE SUMMARIZECOLUMNS('Calendar'[CalendarMonthNumber], 'Calendar'[Calendar Month], __DS0FilterTable1)";

Code for execution of query is:-

var p = new DynamicParameters();
for (int index = 0; index < values.Count; index++)
    p.Add("P" + index,  values.ElementAt(index));
 dynamic results = connection.Query(query, p);

I get a System.NotSupportedException with a message "Specified method is not supported.". Simple connection.Query with the actual value instead of the parameter works.

0

There are 0 best solutions below