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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Change date format in query

For a automated reppord i want to change the date in my url to the first day of the previouse month and the last day of the previuouse month. I got it to work with this querry but the url is still not working becasue it is expacting a date format of yyy-mm-dd. How can i change the date format in this querry? I don't want to change the date format of my whole power bi, just in this querry.

 

raymonvt_0-1616748529503.png

 

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

Hi, @Anonymous 

 

You may modify your query as below to see if it helps.

let 
    start = Date.ToText( Date.EndOfMonth(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-1 )),"yyyy-mm-dd" ),
    end = Date.ToText( Date.StartOfMonth(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-1 )),"yyyy-mm-dd"),
    ...
in
    ...

 

Best Regards

Allan

 

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

4 REPLIES 4
Anonymous
Not applicable

Hello, thanks for helping me with the date time issue, it worekd as intended when changing mm to MM. However, i now get the following error in the querry:

 

raymonvt_0-1617176168446.png

This has probably something to do with the date variables but i have no idea why it is not working

Hi, @Anonymous 

 

Based on the error message, it means Web.Contents only need 1 or 2 parameters while it provides 6 arguments. You need to use text connection symbols to connect text to form a url instead of comma separated.

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

You may modify your query as below to see if it helps.

let 
    start = Date.ToText( Date.EndOfMonth(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-1 )),"yyyy-mm-dd" ),
    end = Date.ToText( Date.StartOfMonth(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-1 )),"yyyy-mm-dd"),
    ...
in
    ...

 

Best Regards

Allan

 

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 @Anonymous 

 

here some example how you can format a date to yy-mm-dd

= Date.ToText(Date.From(DateTime.FixedLocalNow()),"yy-MM-dd")

Jimmy801_0-1616756018577.png

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

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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