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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Villezekeviking
Helper II
Helper II

Do you need a parameter to combine files?

My simple question is; Do I really need this parameter?

Villezekeviking_1-1711577684501.png

 

 

My solution below seems to work fine without the parameter but I'm to novice at this to feel confident that I have not broken something in the process.

 

 

The solution

First I replaced the Parameter1 with the Sample File in the Function here:

Villezekeviking_4-1711578200529.png

 

Then I updated the Transform Sample File to go directly to the Sample File instead of the Parameter:

Villezekeviking_2-1711577955613.png

 


I get the same result as I get with the parameter but I've now removed it. The correct data comes from each of my files.

Villezekeviking_5-1711578345167.png

 

 

Context

The reason I want to dig into this is because I'm building a Power BI Template App that currently uses an Azure Blob storage with JSON files in it. I need to combine them into my query.

The issue is that Parameters of type "Any" or "Binary" is not allowed for Template apps.

Villezekeviking_6-1711578519024.png


I'm looking for validation that my solution will work and know about potential pit falls. What are the cons of removing the parameter like this? What's the risks?

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Here's a decent explanation of how you can do this without the parameter nonsense:
https://www.dutchdatadude.com/loading-multiple-json-files-using-power-query/

 

The basic outline is:

  1. Click on one of the binaries and define what transformations you want to do to it.
  2. Turn that transformation on a specific file into a function.
  3. Add a custom column to your original table calling that function and pass in [Content] and/or whatever columns form the original table you need.
  4. Expand the new custom column.

Here's an example using some random json config files I have on my computer:

let
    Source = Folder.Files("C:\Users\Alexis\Downloads"),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Extension] = ".json") and Text.Contains([Name], "config ")),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows", {"Content", "Name"}),
    #"Added Custom" = Table.AddColumn(#"Removed Other Columns", "Custom", each Json.Document([Content])),
    #"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"acq_function", "rounds", "draw_score"})
in
    #"Expanded Custom"

 In this simple case, I don't define a separate custom function. All I need is a custom column that applies Json.Document to the [Content] column.

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Here's a decent explanation of how you can do this without the parameter nonsense:
https://www.dutchdatadude.com/loading-multiple-json-files-using-power-query/

 

The basic outline is:

  1. Click on one of the binaries and define what transformations you want to do to it.
  2. Turn that transformation on a specific file into a function.
  3. Add a custom column to your original table calling that function and pass in [Content] and/or whatever columns form the original table you need.
  4. Expand the new custom column.

Here's an example using some random json config files I have on my computer:

let
    Source = Folder.Files("C:\Users\Alexis\Downloads"),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Extension] = ".json") and Text.Contains([Name], "config ")),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows", {"Content", "Name"}),
    #"Added Custom" = Table.AddColumn(#"Removed Other Columns", "Custom", each Json.Document([Content])),
    #"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"acq_function", "rounds", "draw_score"})
in
    #"Expanded Custom"

 In this simple case, I don't define a separate custom function. All I need is a custom column that applies Json.Document to the [Content] column.

lbendlin
Super User
Super User

That construct is for beginners.  Once you understand how it works, delete all of it and roll your own ingestion logic.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors