Forum Discussion

inigo-montoya's avatar
inigo-montoya
Copper Contributor
Apr 21, 2022
Solved

Power Query from dynamic URL

Hey Guys,   so I am not too sure about my skillset but I would say im advanced ( I have played around a fair bit with power querys but mostly simple stuff as reformatting data, I havent had anythin...
  • SergeiBaklan's avatar
    Apr 21, 2022

    inigo-montoya 

    That could be like

    let
        thisDate = Date.From(DateTime.LocalNow()),
        day = Date.Day(thisDate),
        adjustedDate =
            if day > 21
            then Date.AddDays( thisDate, 15)
            else thisDate,
        year = Text.From( Date.Year(adjustedDate) ),
        month = Number.ToText( Date.Month(adjustedDate), "00"),
        URL = "https://www.google.com/sites/default/files/documents/" & 
               year & month & "%WEIRDTEXTHERE"
    in
        URL

Resources