Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Is there a way to assign the value of a cell (lets say in sheet 1 A1) to a parameter?
Normally I just type in the value of the parameter, but I would like to be able to change it based on the value in cell A1
Is your PATH parameter set to type text or list?
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
OK I think I have it working now.
There seems to be two ways (or at least two)
1. If i name the Cell with the File location "FilePath" this seems to set a variable "FilePath" to equal this cell.
FilePath = Excel.CurrentWorkbook(){[Name="FilePath"]}[Content]{0}[Column1], Source = Excel.Workbook(File.Contents( FilePath & "BOOK2.xlsx"), null, true),
I was able to bring in a Table with the same information and drill down and it seems to be a text variable called Table2
I assumed that if I just put this in the formula
Source = Excel.Workbook(File.Contents( Table2 & "BOOK2.xlsx"), null, true)
But it doesnt seem to like it:
Looks like that should work. Does Table2 have a "\" at the end of it?
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Not sure why that is being recognized as a little. Can you share all your M code from the advanced editor? Also describe your scenario further so perhaps a simpler way can be suggested.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
You can just use the result of a query that returns a text value where you would use a parameter. Bring in the cell into a query and then drill down as the last step (right click option) and the query will return a text value (or date or number). You can then just use the name of that query where you would a parameter.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
OK, Not sure I am doing this right. What I am trying to create is portable power queries.
Currently I set the folder location to a parameter called "PATH"
EG PATH =
C:\Users\Scott\OneDrive\Desktop\TEST\1\
So I would then use:
Excel.Workbook(File.Contents( PATH & "BOOK2.xlsx"), null, true)
I have found that I can create a function in Excel which updates this location in a Cell which means if I change the folder names it should update when I move the PQ between machines.
So I tried to do the above, but I think it turned it into a Numerical List
Expression.Error: We cannot apply operator & to types List and Text.
Details:
Operator=&
Left=[List]
Right=BOOK2.xlsx