Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Uri.Combine: How to Merge URL Parts

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Uri.Combine takes a base URL and a relative path and returns one properly joined absolute URL, inserting or removing slashes as needed. The syntax is Uri.Combine(baseUri as text, relativeUri as text) as text, and it is available in Power Query in Excel and Power BI. You do not need any add-in or special permission to use it.

What You'll Need

  • Power Query Editor open in Excel or Power BI Desktop.
  • A query or table containing the base URL and the relative path you want to join (or you can type them as text values).
  • Basic familiarity with adding a custom column or editing the formula bar.

Step-by-Step

  1. Load your data into Power Query. Select your table and choose Data > From Table/Range (Excel) or Home > Transform data (Power BI). If you are starting from scratch, use Get Data > From Other Sources > Blank Query and enter values manually. Menu labels can differ slightly by version, device or region.
  2. Confirm the base URL column is text. Select the column header and check that the type icon shows ABC (text). If it shows a number or Any, click the icon and choose Text. Uri.Combine expects text; a non-text value returns an error.
  3. Add a custom column. Go to Add Column > Custom Column. In the dialog, name the new column (for example, FullUrl).
  4. Enter the formula. In the formula box type Uri.Combine([BaseUrl], [RelativePath]), replacing the bracketed names with your actual column names. Column names are case-sensitive in Power Query, so match the exact header text.
  5. Click OK. Power Query adds the column. Review a few rows: the result should be a single URL with one slash between the base and the path.
  6. Check the output type. If the new column is typed as Any, click the type icon and set it to Text so later steps treat it as a string.
  7. Test edge cases. Try a base URL ending in a slash, a relative path starting with a slash, and a relative path that is a full URL. Uri.Combine handles these combinations, but verifying them in your data prevents surprises.
  8. Apply and close. Choose Home > Close & Load (Excel) or Home > Close & Apply (Power BI) to write the result back to your workbook or model.

Common Mistakes

  • Passing a null value. If either argument is null, the function returns null rather than an error. Filter out blanks first if you need a valid URL in every row.
  • Using the wrong column names. Power Query is case-sensitive; [BaseURL] and [BaseUrl] are different. Copy the header text exactly.
  • Expecting it to validate the URL. Uri.Combine joins strings; it does not check that the result resolves or that the domain exists. Use a web request step if you need to test reachability.
  • Forgetting to set the column type. A column left as Any can behave unpredictably in later merge or filter steps.
  • Manually concatenating with & instead. String concatenation does not add or remove slashes, so you can end up with double slashes or missing ones. Uri.Combine handles that.

Tips

  • Use Uri.Combine whenever you build API endpoints from a base host and a path; it keeps the slash logic consistent across rows.
  • If your relative path comes from a parameter, reference the parameter name directly in the formula instead of a column.
  • Keep the base URL in a single query or parameter so you can change it in one place rather than editing every row.
  • For query strings, append them after combining the path, or pass the full path with the query string as the relative part.
  • Preview the step in the formula bar before clicking OK; Power Query shows the function signature as you type.

Troubleshooting

  • Error: "We cannot convert the value to type Text." One of the arguments is not text. Change the column type to Text or wrap the value with Text.From().
  • Result is null. Check for nulls or blanks in either input column and filter or replace them before the custom column step.
  • Double slashes in the result. Confirm you are using Uri.Combine and not a manual & concatenation; the function normalizes the boundary slash.
  • Function not recognized. Uri.Combine is part of the standard library in current Power Query versions. If it is unavailable, update Excel or Power BI Desktop to a current release.
  • Column name error. The formula references a column that no longer exists after a rename or remove step. Re-add the step or update the name.
  • If that did not work, delete the custom column step and rebuild it from the Applied Steps pane, checking each argument against the actual column headers.

Frequently Asked Questions

What does Uri.Combine actually do?

It joins a base URI and a relative URI into one text string, adding or removing the separating slash so the result is a valid absolute URL.

Is Uri.Combine available in both Excel and Power BI?

Yes, it is part of the standard Power Query function library used by both. Availability depends on your version, so keep the app updated.

Does it work with relative paths that start with a slash?

Yes. It normalizes the boundary so you do not get a double slash or a missing one, whichever form you pass.

Can I combine more than two parts at once?

No, the function takes two arguments. For three or more parts, nest calls such as Uri.Combine(Uri.Combine(base, part1), part2) or build the path first.

Why did I get null instead of an error?

Uri.Combine returns null when either input is null. Filter or replace nulls before the step if you need a URL in every row.

Does Uri.Combine check that the URL is reachable?

No. It only builds the string. To test reachability you need a separate web request step, which may require credentials or permissions.