Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
crln-blue
Post Patron
Post Patron

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:

crln-blue_0-1608608030785.png

 

Type: Any Value

 

Here's my query:

crln-blue_1-1608608060523.png

 

 

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!

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

4 REPLIES 4
PhilipTreacy
Super User
Super User

@crln-blue 

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.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


crln-blue
Post Patron
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!

crln-blue_0-1608617778301.png

 

PhilipTreacy
Super User
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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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):

crln-blue_0-1608616432350.png

 

 

So how do I use my parameter on a calculated measure? Thanks!

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors