Power Bi:使用以下命令导入嵌套json查询

时间:2019-12-11 17:22:44

标签: json powerbi

我想使用power bi导入以下json。我之前已经导入了更扁平的json,但是没有太多的嵌套记录和列表。例如,让我们获取“答案”记录,它还有5条相同的记录,并且结构相同,然后让“ initial_question”记录具有值列表,其中包含一条记录,然后是字段名称记录,然后是我想要的值。任何想法如何在Power Bi中做到这一点?

{"metadata":
    {"device_id":"Android_cfb576b2-XXXXXX","user_id":null,"username":"XXXXXXX","submitted_at":"2019-12-10 18:52:16 +00:00","received_at":"2019-12-10 18:52:14 +00:00","submission_id":"42776798","device_submission_identifier":"5e071197-XXXXXXXXXXXXXXX","submission_counter":"1","form_name":"2. XXXXXXXXXXXXXXXXXXXXXXX ","form_version":"1.02"},

"answers":
    {"initial_questions":{"values":[{"conducted_on":{"value":"2019-12-10"},"start_time":{"value":"2019-12-10 14:45:32"},"shift":{"value":"afters"},"operator_name_":{"value":"XXXXXXXXXXXX"},"Machine":{"value":"XXXXXXXXXXXXXX"}}]},

    "Work_Information":{"values":[{"Part_number":{"value":"XXXXXXXXXX"},"_1st_or_2nd_end_Machining":{"value":"Both"},"Work_Area_Tidy_":{"value":"Yes"},"Yes_No_Question":{"value":true}}]},

    "Pre_machining_checks":{"values":[{"Head_Bearings_Greased_":{"value":"N/A"},"check_cuttings_tips":{"value":true},"Checked_Oil_level":{"value":true},"check_measuring_and_gauging_equipment__micrometer_ect_":{"value":true},"Check_coolant":{"value":true},"Check_process_sheets":{"value":true},"First_off_ok_":{"value":"01FWHSBGOOFJI6RXSARNBJE4YV2FHWIUJJ"}}]},

    "Lost_Time":{"values":[{"_1st_off_cut":{"value":10.0},"Setup_machine_centre":{"value":0},"Tool_change":{"value":0},"Wait_for_Fork_Lift_Truck_driver":{"value":0},"Wait_Fork_Lift_Truck":{"value":20},"meal_break___tea_Break___Wash_Off":{"value":20},"Clean_machine_centre_scrap_out":{"value":30},"Fill_Coolant":{"value":15},"Other_lost_time":{"value":0}}]},

    "Post_Machine_checks":{"values":[{"Last_off_cut_ok_":{"value":"01FWHSBGN45Z2E673KFRCZOGXSILA7T75A"},"Head_bearings_greased_":{"value":false},"Checked_cutting_Tips_":{"value":true},"Checked_measuring_equipment__micrometer_ect_":{"value":true},"Checked_Coolant_Levels":{"value":true},"Process_Sheets_Returned_":{"value":true}}]},

    "end_of_shift_report":{"values":[{"Number_of_good__compliment__parts_produced_":{"value":80},"Number_Of_parts_scrapped_":{"value":0},"Number_of_parts_reworked__":{"value":0},"Tooling_Last_off_ok_":{"value":"pass"},"End_Time_":{"value":"2019-12-10 21:15:07"},"Tooling_ok_after_last_off_":{"value":true},"Working_area_tidy_":{"value":true},"Any_comments_not_captured_above_":{"value":"XXXXXXXXXXXXXXXXXXXXXXX"},"End_Time":{"value":"2019-12-10 21:15:37"}}]}
    }
}

以下是该过程的屏幕显示,谢谢。

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

将列表转换为表格,然后将列扩展为新的“值”或“行”,然后查看其形状是否符合您的要求。在需要时取消透视列。 如果没有帮助,则可能必须将其中一些记录分成新的查询,并构建几个表。