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! Learn more

Reply
apipko
New Member

Insert current date in extended editor

I get data via json

 

let
content = "
{
  ""dimensions"": [""daily""],
  ""metrics"": [""visits"",""leads"",""sales"",""profit"",""marketing_cost"",""roi""],
  ""period"": {
    ""from"":""2017-06-06T00:00:00+0300"",
    ""to"":""2017-07-05T23:59:59+0300""
  }
}
",  

How to insert in "to" current date automatically in extended editor? Thank you!

 

1 ACCEPTED SOLUTION

@apipko,

 

See text below.

    ""to"":""" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & "T00:00:00+0300""
Community Support Team _ Sam Zha
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
apipko
New Member

let
content = "
{
  ""dimensions"": [""daily""],
  ""metrics"": [""paidLeadsPrice"",""visits"",""leads"",""sales"",""profit"",""visitsCost"",""roi""],
  ""period"": {
    ""from"":""2017-06-01T00:00:00+0300"",
    ""to"":""2017-07-01T00:00:00+0300""
  }
}
",
    Source = Json.Document(Web.Contents("https://cloud.roistat.com/api/v1/project/analytics/data?project=50147&key=52d70cb079888f14092d5e9e13e3c3cb", [Content=Text.ToBinary(content)]))
in
    Source

This is a working example, please show how to insert the current date in the field ""to"" automically?

@apipko,

 

See text below.

    ""to"":""" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd") & "T00:00:00+0300""
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-chuncz-msft
Community Support
Community Support

@apipko,

 

In addition, you may need to use DateTime.ToText.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
Community Champion

If I paste that code into Advanced Editor it errors. That also does not appear to be valid JSON syntax so I am a little confused. Date.LocalNow will return the current date and time.

 

https://msdn.microsoft.com/en-us/library/mt253492.aspx

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

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

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