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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
rmcgrath
Advocate II
Advocate II

How to make a parameter be today's date

I have created two parameters:

StartDateParam = 1/1/2022

EndDateParam = 3/5/2024

 

I have the following M code to pull in a stored procedure into Power BI:

 

let
     StartDate = Text.From ( StartDateParam ),
     EndDate = Text.From ( EndDateParam ),
     Source = Sql.Database("S-DB2-VMC\VERSOVA_PROCDATA", "EggProcPlant_Test",
     [Query="EXECUTE [dbo].[sp_Gp_GrdEggSalesComb]#(lf) @Startd = '" & StartDate & "'#(lf) , @Endd = '" & EndDate & "'"])
in
     Source

 

Works great...however, I would like to have the EndDateParam always use today's date so I don't have to manually update the parameter each time.  How would I do that?

2 ACCEPTED SOLUTIONS

@rmcgrath 

i dont get, why you want to put it in the current value . 

 

i meant go to advanced edior 

Daniel29195_0-1709758266873.png

 

and change the m code for the following line . 

 

 

let me know if this helps /

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠:

View solution in original post

Got it...thank you!!  I appreciate the help!

View solution in original post

4 REPLIES 4
Daniel29195
Super User
Super User

@rmcgrath 

 

please try this : 
EndDateParam = Text.From(DateTime.Date(DateTime.LocalNow()))

 

let me know if this helps .

 


If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

Thank you for the quick response!  Unfortunately, I get the following error:  DataSource.Error: Microsoft SQL: Error converting data type varchar to datetime.

 

How do I put that formula into the Parameter editor?  I tried the attached screenshot, but it did not work (produced the error above)

rmcgrath_0-1709676023211.png

 

 

@rmcgrath 

i dont get, why you want to put it in the current value . 

 

i meant go to advanced edior 

Daniel29195_0-1709758266873.png

 

and change the m code for the following line . 

 

 

let me know if this helps /

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠:

Got it...thank you!!  I appreciate the help!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Solution Authors
Top Kudoed Authors