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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JJJJJJJJ
Frequent Visitor

set default value of text parameter using a query

With a binary parameter type, you can set the default value by way of a query.

With a text parameter type, there is no default value option.

 

I have a text parameter in a query that I've made into a function. 

When I'm testing changes to the query, I want that parameter to be driven by a query. 

 

Current workaround is that I can swap the parameter out for a query in the table to test, but that breaks the function, so I have to swap back to the parameter before I can use the query again. 

 

Has anyone found any other way around this, or a way of giving the text parameter a default value driven by a query? 

2 REPLIES 2
JJJJJJJJ
Frequent Visitor

Thank you for the response, I may have not understood but I think this is a slightly different scenario with SQL queries.

 

I have a text parameter, the query option here is a Power Query, and can certainly be used to provide a list of options, but what I want is to set the default value like with the Binary Type. The below parameter uses a query to pull the latest doc in a SharePoint library for example. Why can't I have a parameter that uses the latest filename?

JJJJJJJJ_1-1662394616803.png

 

I need it to be a parameter because while I use the default value when testing, when created as a function it will get passed a value.

v-yalanwu-msft
Community Support
Community Support

Hi, @JJJJJJJJ ;

To create the parameter, open Query Editor, click the Manage Parameters down arrow on the Home ribbon, and then click New Parameter. In the Parameters dialog box, type SqlSrvInstance in the Name text box, and then type a parameter description in the Description text box.

Can you see if this link can help you?

Power BI Introduction: Working with Parameters in Power BI Desktop —Part 4 - Simple Talk (red-gate.c...


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors