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

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.

Reply
virus190
Helper II
Helper II

Replace duration with parameter

Hi,

 

im using #duration(0,7,30,0) in my Power Query. But i want it to be a parameter.

 

Now:

Table.AddColumn(#"Changed Typ", "WorkingDay", each [Date]- #duration(0,7,30,0))


I tried:

- creating a parameter with time = 0,7,30,0 and then using it in Power Query --> #duration(time) 

- creating a parameter with time = #duration(0,7,30,0) and then using it in Power Query --> time

didnt work.

 

What did work:

- creating a paramter with time = 7 and then using it in Power Query --> #duration(0,time,30,0)


But i want both, hour and time to be a paramater. Is there a better way then using 2 parameter?

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @virus190 

Create three blank queries, enter codes in Advanced editor,

hour list

let
    Source = {1..24}
in
    Source

minutes list

let
    Source = {0..59}
in
    Source

day list

let
    Source = {0..30}
in
    Source

 

Then create three parameters

Capture2.JPGCapture3.JPG

Use parameter in table

Capture1.JPG

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

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @virus190 

Create three blank queries, enter codes in Advanced editor,

hour list

let
    Source = {1..24}
in
    Source

minutes list

let
    Source = {0..59}
in
    Source

day list

let
    Source = {0..30}
in
    Source

 

Then create three parameters

Capture2.JPGCapture3.JPG

Use parameter in table

Capture1.JPG

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

Jimmy801
Community Champion
Community Champion

Hello

 

Create a new blank query and name it like you want the parameter to be named. Then go to the advanced editor and paste in this code. This should do the trick

(#duration(0,7,30,0)) meta [IsParameterQuery=true, Type="Any", IsParameterQueryRequired=true]

you can then apply your parameter using a Syntax like

DateTime.LocalNow() + YouParameterName


If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

 

Hello,

 

thank you very much. This does work.

 

But i want that the user to be able to change the duration from the parameter. Thats the goal.

 

Like this:

Example 


But change it from 7,30 to maybe 8,00


Is this possible?

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors