Forum

Build Dynamic Web u...
 
Notifications
Clear all

Build Dynamic Web url

6 Posts
3 Users
0 Reactions
69 Views
(@warthur)
Posts: 3
Active Member
Topic starter
 

Hi,

Using the date and time example from exercise 7.06 all worked as per the exercise.  I then decided to test myself and go further and convert the parameters into dynamic ones - this is where I have come unstuck.  I've successfully managed dynamic path and folders before but can't nut this one out and suspect I've confused myself, or am over-thinking.  I keep getting errors.

The want: I want to pull public holiday dates for different years, regions and holiday type combinations, where users can input into worksheet cells (using a table (or equivalent)), & simply refresh the data - the intent is for use by non-power query users. 

Using dateandtime.com/holidays/Region/Year, filtered based on an chosen Holiday Type, all of which would have a data validation to ensure correct and valid selections before query refresh.

Example 1:-
Region: Australia
Year: 2024
Holiday Type: National Holidays, State Holiday (selected from the query unique list from the earlier query)

Happy for the queries to be individual given the refresh is quick.

Please Help, I'm stuckEmbarassedConfused

 
Posted : 17/09/2023 8:41 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Wendy,

You have to provide your attempts and indicate the step that fails and the error message, it will be much easier to understand the problem.

thank you

 
Posted : 18/09/2023 11:43 am
(@warthur)
Posts: 3
Active Member
Topic starter
 

Hi, apologies for the delay in coming back.

Unfortunately I had deleted the files when I couldn't get it to work.  I started to recreate the attempt and got different errors again at the URL stage.  I've attached the file before I'd added the lines about declaring the variable names from the worksheet range namesPQ-Variables.PNG

The attached screenshot shows highlighted the components I am trying to make dynamic, without creating 
a parameter, unless of course I can make a parameter dynamic by using inputs from the worksheet.

Thanks, W 

 
Posted : 02/10/2023 11:29 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Wendy,

Try these queries please:

Name this query "GetHolidaysData":

(region as text, year as text)=>
let
Source = Web.Page(Web.Contents("https://www.timeanddate.com/holidays/" & region & "/" & year)),
Data0 = Source{0}[Data],
#"Added Custom" = Table.AddColumn(Data0, "Custom", each [Date] & year),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", type date}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Header", "Date"})
in
#"Removed Columns"

 

The main query is this:

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Year", type text}, {"Region", type text}, {"Holiday Type", type any}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each GetHolidaysData([Region],Text.From([Year]))),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"", "Name", "Type", "Details", "Custom"}, {"Column1", "Name", "Type", "Details", "Custom.1"})
in
#"Expanded Custom"

</code

 
Posted : 16/10/2023 12:12 am
(@warthur)
Posts: 3
Active Member
Topic starter
 

Hi Catalin,

I must be doing something wrong, I've copied the codes above - now I get this error on the MainQuery code.  The first query seemed happy.

Formula.Firewall: Query 'MainQuery' (step 'Expanded Custom') is accessing data sources that have privacy levels which cannot be used together. Please rebuild this data combination.

Thanks,

W

 
Posted : 06/11/2023 1:18 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Wendy,

I cover Formula Firewall Errors in lesson 7.05. See if that helps. If not, please come back and let us know.

Mynda

 
Posted : 08/11/2023 8:07 pm
Share: