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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Sequel: How to make a variable in connection string? (dynamic Epoch in URL)

Hello forum,

I would like to come back to the post: https://community.powerbi.com/t5/Power-Query/How-to-make-a-variable-in-connection-string/m-p/73380/h... as I think there was no solution provided. At least it doesn't work for me. The parameter solution didn't work as it is static in a sense.

 

Please find the PBIX here.

 

If I place something like this into the "Yahoo finance" piece resp. URL part

Duration.TotalSeconds(Date.AddMonths(DateTime.FixedLocalNow(), -1) - #datetime(1970, 1, 1, 0, 0, 0))

I get this

minime_0-1594207271024.png

 

Any idea how to make this work?

 

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try wrapping your calculation result in Text.From the error is due to mixed data types.

Text.From( Duration.TotalSeconds( Date.AddMonths( DateTime.FixedLocalNow(), -1 ) - #datetime( 1970, 1, 1, 0, 0, 0 ) ) )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

3 REPLIES 3
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try wrapping your calculation result in Text.From the error is due to mixed data types.

Text.From( Duration.TotalSeconds( Date.AddMonths( DateTime.FixedLocalNow(), -1 ) - #datetime( 1970, 1, 1, 0, 0, 0 ) ) )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

@Mariusz,

 

thank you, almost, I guess, the decimals are getting in the way. Do you know why?

 

minime_0-1594211409077.png

 

Anonymous
Not applicable

I think I got it:

 

 

 

Text.From(Number.RoundDown(Duration.TotalSeconds( Date.AddMonths( DateTime.FixedLocalNow(), 0 ) - #datetime( 1970, 1, 1,0,0,0 ) ) ))

 

 

@Mariusz, thank you very much!

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.