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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Import from web - dynamic year today range

Dear All!

I would like to ask for your help with the following case.

 

I have a website to import data from on daily basis.

Importing data from a specific date till today. I have the problem with the today part.

 

deviza=rbCurrencyActual&devizaSelected=ZAR&datefrom=2022.01.01.&datetill=2022.03.13.&order=1
 
 
I highlited the part of the date of today. 
Do you have any recommendation, how can I replace this fix date with a dynamic today formula?
 
I have tried the datetime.localnow funtction converting into text, but with no success.
 
Thank you in davance for your help and support
Best regards
S.
 
 
 
 
1 ACCEPTED SOLUTION

Please change your Source line to this.

 

Source = Web.BrowserContents("https://www.mnb.hu/arfolyam-tablazat?deviza=rbCurrencyActual&devizaSelected=ZAR&datefrom=2022.02.12...." & Date.ToText(Date.From(DateTime.LocalNow()), "yyyy.MM.dd.") & "&order=1"),

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

6 REPLIES 6
mahoneypat
Microsoft Employee
Microsoft Employee

You can use this expression to get the current date in the needed format. You can either concatenate it into your string, or create it in a separate variable and use that.

 

= Date.ToText(Date.From(DateTime.LocalNow()), "yyyy.MM.dd")

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat !

The "yyyy.MM.dd" part is giving me a Token Comma Expected error.

Any idea, what might have gone worng?

Thank you

S

Please post your entire M code from the Advanced Editor. Also, I forgot the last . in your date format but you can easily add that.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat 

 

let
Source = Web.BrowserContents("https://www.mnb.hu/arfolyam-tablazat?deviza=rbCurrencyActual&devizaSelected=ZAR&datefrom=2022.02.12...."),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.pricetable > * > TR > :nth-child(1)"}, {"Column2", "TABLE.pricetable > * > TR > :nth-child(2)"}, {"Column3", "TABLE.pricetable > * > TR > :nth-child(3)"}, {"Column4", "TABLE.pricetable > * > TR > :nth-child(4)"}, {"Column5", "TABLE.pricetable > * > TR > :nth-child(5)"}, {"Column6", "TABLE.pricetable > * > TR > :nth-child(6)"}, {"Column7", "TABLE.pricetable > * > TR > :nth-child(7)"}, {"Column8", "TABLE.pricetable > * > TR > :nth-child(8)"}, {"Column9", "TABLE.pricetable > * > TR > :nth-child(9)"}, {"Column10", "TABLE.pricetable > * > TR > :nth-child(10)"}, {"Column11", "TABLE.pricetable > * > TR > :nth-child(11)"}, {"Column12", "TABLE.pricetable > * > TR > :nth-child(12)"}, {"Column13", "TABLE.pricetable > * > TR > :nth-child(13)"}, {"Column14", "TABLE.pricetable > * > TR > :nth-child(14)"}, {"Column15", "TABLE.pricetable > * > TR > :nth-child(15)"}, {"Column16", "TABLE.pricetable > * > TR > :nth-child(16)"}, {"Column17", "TABLE.pricetable > * > TR > :nth-child(17)"}, {"Column18", "TABLE.pricetable > * > TR > :nth-child(18)"}, {"Column19", "TABLE.pricetable > * > TR > :nth-child(19)"}, {"Column20", "TABLE.pricetable > * > TR > :nth-child(20)"}, {"Column21", "TABLE.pricetable > * > TR > :nth-child(21)"}, {"Column22", "TABLE.pricetable > * > TR > :nth-child(22)"}, {"Column23", "TABLE.pricetable > * > TR > :nth-child(23)"}, {"Column24", "TABLE.pricetable > * > TR > :nth-child(24)"}, {"Column25", "TABLE.pricetable > * > TR > :nth-child(25)"}, {"Column26", "TABLE.pricetable > * > TR > :nth-child(26)"}, {"Column27", "TABLE.pricetable > * > TR > :nth-child(27)"}, {"Column28", "TABLE.pricetable > * > TR > :nth-child(28)"}, {"Column29", "TABLE.pricetable > * > TR > :nth-child(29)"}, {"Column30", "TABLE.pricetable > * > TR > :nth-child(30)"}, {"Column31", "TABLE.pricetable > * > TR > :nth-child(31)"}, {"Column32", "TABLE.pricetable > * > TR > :nth-child(32)"}, {"Column33", "TABLE.pricetable > * > TR > :nth-child(33)"}, {"Column34", "TABLE.pricetable > * > TR > :nth-child(34)"}, {"Column35", "TABLE.pricetable > * > TR > :nth-child(35)"}, {"Column36", "TABLE.pricetable > * > TR > :nth-child(36)"}, {"Column37", "TABLE.pricetable > * > TR > :nth-child(37)"}, {"Column38", "TABLE.pricetable > * > TR > :nth-child(38)"}, {"Column39", "TABLE.pricetable > * > TR > :nth-child(39)"}, {"Column40", "TABLE.pricetable > * > TR > :nth-child(40)"}, {"Column41", "TABLE.pricetable > * > TR > :nth-child(41)"}, {"Column42", "TABLE.pricetable > * > TR > :nth-child(42)"}, {"Column43", "TABLE.pricetable > * > TR > :nth-child(43)"}, {"Column44", "TABLE.pricetable > * > TR > :nth-child(44)"}, {"Column45", "TABLE.pricetable > * > TR > :nth-child(45)"}, {"Column46", "TABLE.pricetable > * > TR > :nth-child(46)"}, {"Column47", "TABLE.pricetable > * > TR > :nth-child(47)"}, {"Column48", "TABLE.pricetable > * > TR > :nth-child(48)"}, {"Column49", "TABLE.pricetable > * > TR > :nth-child(49)"}, {"Column50", "TABLE.pricetable > * > TR > :nth-child(50)"}, {"Column51", "TABLE.pricetable > * > TR > :nth-child(51)"}, {"Column52", "TABLE.pricetable > * > TR > :nth-child(52)"}, {"Column53", "TABLE.pricetable > * > TR > :nth-child(53)"}, {"Column54", "TABLE.pricetable > * > TR > :nth-child(54)"}, {"Column55", "TABLE.pricetable > * > TR > :nth-child(55)"}, {"Column56", "TABLE.pricetable > * > TR > :nth-child(56)"}, {"Column57", "TABLE.pricetable > * > TR > :nth-child(57)"}, {"Column58", "TABLE.pricetable > * > TR > :nth-child(58)"}, {"Column59", "TABLE.pricetable > * > TR > :nth-child(59)"}, {"Column60", "TABLE.pricetable > * > TR > :nth-child(60)"}, {"Column61", "TABLE.pricetable > * > TR > :nth-child(61)"}, {"Column62", "TABLE.pricetable > * > TR > :nth-child(62)"}, {"Column63", "TABLE.pricetable > * > TR > :nth-child(63)"}, {"Column64", "TABLE.pricetable > * > TR > :nth-child(64)"}, {"Column65", "TABLE.pricetable > * > TR > :nth-child(65)"}, {"Column66", "TABLE.pricetable > * > TR > :nth-child(66)"}, {"Column67", "TABLE.pricetable > * > TR > :nth-child(67)"}, {"Column68", "TABLE.pricetable > * > TR > :nth-child(68)"}, {"Column69", "TABLE.pricetable > * > TR > :nth-child(69)"}, {"Column70", "TABLE.pricetable > * > TR > :nth-child(70)"}, {"Column71", "TABLE.pricetable > * > TR > :nth-child(71)"}, {"Column72", "TABLE.pricetable > * > TR > :nth-child(72)"}, {"Column73", "TABLE.pricetable > * > TR > :nth-child(73)"}, {"Column74", "TABLE.pricetable > * > TR > :nth-child(74)"}, {"Column75", "TABLE.pricetable > * > TR > :nth-child(75)"}, {"Column76", "TABLE.pricetable > * > TR > :nth-child(76)"}}, [RowSelector="TABLE.pricetable > * > TR"]),
#"Changed Type" = Table.TransformColumnTypes(#"Extracted Table From Html",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}, {"Column12", type text}, {"Column13", type text}, {"Column14", type text}, {"Column15", type text}, {"Column16", type text}, {"Column17", type text}, {"Column18", type text}, {"Column19", type text}, {"Column20", type text}, {"Column21", type text}, {"Column22", type text}, {"Column23", type text}, {"Column24", type text}, {"Column25", type text}, {"Column26", type text}, {"Column27", type text}, {"Column28", type text}, {"Column29", type text}, {"Column30", type text}, {"Column31", type text}, {"Column32", type text}, {"Column33", type text}, {"Column34", type text}, {"Column35", type text}, {"Column36", type text}, {"Column37", type text}, {"Column38", type text}, {"Column39", type text}, {"Column40", type text}, {"Column41", type text}, {"Column42", type text}, {"Column43", type text}, {"Column44", type text}, {"Column45", type text}, {"Column46", type text}, {"Column47", type text}, {"Column48", type text}, {"Column49", type text}, {"Column50", type text}, {"Column51", type text}, {"Column52", type text}, {"Column53", type text}, {"Column54", type text}, {"Column55", type text}, {"Column56", type text}, {"Column57", type text}, {"Column58", type text}, {"Column59", type text}, {"Column60", type text}, {"Column61", type text}, {"Column62", type text}, {"Column63", type text}, {"Column64", type text}, {"Column65", type text}, {"Column66", type text}, {"Column67", type text}, {"Column68", type text}, {"Column69", type text}, {"Column70", type text}, {"Column71", type text}, {"Column72", type text}, {"Column73", type text}, {"Column74", type text}, {"Column75", type text}, {"Column76", type text}})
in
#"Changed Type"

Please change your Source line to this.

 

Source = Web.BrowserContents("https://www.mnb.hu/arfolyam-tablazat?deviza=rbCurrencyActual&devizaSelected=ZAR&datefrom=2022.02.12...." & Date.ToText(Date.From(DateTime.LocalNow()), "yyyy.MM.dd.") & "&order=1"),

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Dear @mahoneypat 

Working. Thank you very much.

Br,

S

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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