Forum Discussion
Passing a parameter to query: We cannot convert a value of type Table to type Function.
Hello!
I want to have a parameter where I can use it on my measures (What If scenario is not applicable because it only accepts 4 digits), and I stumbled upon: Solved: Passing Parameters in measures - Microsoft Power BI Community
So I made my parameter and used it as a source for table query but it has the following error (I'm very new to Power Query and I do admit that I don't understand it much that's why I'm relying to samples on the web):
Here's my parameter:
Type: Any Value
Here's my query:
let
Source = data({"End Cash"},{{Param1}})
in
Source
Error:
Expression.Error: We cannot convert a value of type Table to type Function.
Details:
Value=[Table]
Type=[Type]
Any tips? My parameter is inside my soure table "data". Thanks!
Hi crln-blue
When you use the table name data and then follow it with () PQ thinks you're calling a function. As data is a table, you get the error you are seeing.
What exactly are you trying to do?
It looks like you are trying to pass the string "End Cash" and the parameter into your data table for something. If you want to use the value for Param1 inside another query you can use its name.
Perhaps you can provide a screenshot of what your data table looks like and explain what you want to do with the string "End Cash" and the parameter.
regards
Phil
4 Replies
- PhilipTreacy
Super User
Hi crln-blue
When you use the table name data and then follow it with () PQ thinks you're calling a function. As data is a table, you get the error you are seeing.
What exactly are you trying to do?
It looks like you are trying to pass the string "End Cash" and the parameter into your data table for something. If you want to use the value for Param1 inside another query you can use its name.
Perhaps you can provide a screenshot of what your data table looks like and explain what you want to do with the string "End Cash" and the parameter.
regards
Phil
- crln-blue
Post Patron
Hello PhilipTreacy ! Thanks for the reply!
I want to use the parameter on my calculated measure. I saw somewhere that to be able to use it, I can pass it to a table. What If scenario won't work for me because I noticed that it only accepts up to 4 digits.
My data table is like this but has more columns. No computation on the data table since my computations are on a different table (summarized dax table):
So how do I use my parameter on a calculated measure? Thanks!
- crln-blue
Post Patron
Hello again PhilipTreacy !
I tried your suggestion and it worked! I simply places it in the let in the source. I was able to convert it into a table using the Convert To Table function. Thanks!
- PhilipTreacy
Super User
Great, glad I was able to help.
Regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.