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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
zua
Frequent Visitor

Power Query Parameter with default Value

Hello, 

 

is it possible in Power Query M to add a parameter to a function which has a default value?

My goal is that if the function is called the parameter is shown with its default value,

but the value can be changed. 

 

Something like that even if it does not work: (param1, param2 = 20, param3) => ...

 

Is this possible?

 

Thank you! 

1 ACCEPTED SOLUTION

func = (param1, optional param2) => param1 + (param2 ?? 20), 
use1 = func(1, 10), // 11
use2 = func(1)      // 21

View solution in original post

4 REPLIES 4
zua
Frequent Visitor

Hello @AlienSx, thank you. But what should I do after I made the parameter optional. Can you give me an example? 

func = (param1, optional param2) => param1 + (param2 ?? 20), 
use1 = func(1, 10), // 11
use2 = func(1)      // 21
zua
Frequent Visitor

Thank you.

 

Is it possible that a number is displayed as the default parameter value, 

when invoking the function.

 

Something like that, when "20" is already displayed when the function is called

zua_0-1720623531969.png

 

AlienSx
Super User
Super User

make it optional and analyse it inside your function for null: param2 ?? 20. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.