Forum Discussion
Paginated report - build DAX expression with report parameters
Is it possible to build a DAX expression like this:
"COUNT(" & Parameters.parameter_TableName.Value + "[Field1])"
Will EVALUATE actually run something like this?
Thanks
4 Replies
- AlexisOlson
Super User
You can certainly run DAX queries including parameters against a Power BI dataset in Report Builder but I don't know that you can pass it parameters for table names like that. Typically, you pass a string, a number, or a date.
You could probably do this:
DEFINE VAR Tbl = @TableNameParameter EVALUATE SWITCH ( Tbl, "Table1", SUMMARIZE ( Table1, Table1[Column1], "Count", COUNT ( Table1[Field1] ) ), "Table2", SUMMARIZE ( Table2, Table2[Column1], "Count", COUNT ( Table2[Field1] ) ) )- Markzolotoy
Impactful Individual
So, string concatenation will not work? Also, is TableNameParameter a report parameter and/or DAX parameter creted interactively in the design mode?
- AlexisOlson
Super User
I haven't tried string concatenation like you suggested but it seems unlikely to me that would work. Doesn't hurt to try though.
What I wrote was for using a parameter that you'd need to map to a report builder parameter.