简体   繁体   English

将 JSON 文件导入 Power BI 时,有没有办法将文件名插入记录?

[英]Is there a way to insert the filename into the record when importing a JSON file into Power BI?

Not sure how to ask this but here goes.不知道如何问这个,但这里有。 I have a collection of 500+ JSON files that I need to import into PowerBI.我收集了 500 多个 JSON 文件,我需要将这些文件导入 PowerBI。 Each JSON has four different levels of information that I need to parse out.每个 JSON 都有四个不同级别的信息,我需要解析出来。 I converted the JSON top-level info into a table and transposed it so I had one row like the attached screenshot.我将 JSON 顶级信息转换为表格并将其转置,因此我有一行,如随附的屏幕截图。 enter image description here在此处输入图像描述

My first question is: can I easily add the filename to the JSON record?我的第一个问题是:我可以轻松地将文件名添加到 JSON 记录吗? I would like to use the filename as a unique key in later queries.我想在以后的查询中使用文件名作为唯一键。

Thanks!谢谢!

It looks like you may be connecting to each JSON file individually?看起来您可能正在单独连接到每个 JSON 文件? If I'm correct, assuming all the JSON files can be in a single folder, you can use the "Folder" connection.如果我是正确的,假设所有 JSON 文件可以在一个文件夹中,您可以使用“文件夹”连接。 That then allows you to right-click on the original folder query and choose "reference" to then create various transformations for each JSON file, and it includes the file name.然后,您可以右键单击原始文件夹查询并选择“参考”,然后为每个 JSON 文件创建各种转换,并包含文件名。

Related details: https://powerbi.tips/2016/06/loading-data-from-folder/相关详情: https://powerbi.tips/2016/06/loading-data-from-folder/

https://docs.microsoft.com/en-us/power-bi/guidance/power-query-referenced-queries https://docs.microsoft.com/en-us/power-bi/guidance/power-query-referenced-queries

Hoping that helps!希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM