Sometimes you want to use JSON data in Power BI. And sometimes Power BI doesn’t exactly do what you want it to do with the information. This blog will explain how to easily make your JSON data readable with Power BI Desktop.
Initially, we start from a .json file as shown in the image below.
When you select JSON as your data source, Power BI is smart enough to parse the JSON in all the available columns for you, which is the result we want. But in some cases, you will find the whole JSON data in one column. If that is the case, this blog will guide you in the right direction to retrieve all the available columns that are listed in the JSON data.
To reach this starting point, we created an Excel file that contains the same data as our .json file. The data is about orders that have been made by a specific customer. For each order, we have put it in a cell in Excel. This Excel file will be our data source that we import into Power BI Desktop.
After importing this Excel file, we have a column containing all this JSON data in one column. This will be our starting point.
If you have a similar column like ours, head over to your Power Query Editor to transform the table that has the column that contains the JSON data. That’s step one. In our table ‘OrderDetails’, we have five records containing the details of an order in JSON format. When selecting one of the records, you will see the whole JSON data below.
Step 2: In case you don’t have one already, add an index column.
Step 3: Luckily, there is a ‘Parse JSON’ option in the ‘Add Column’ section. This will create an extra column that contains the records.
By clicking on one of the records in the newly added column, you will also see what is inside each record.
Step 4: In the new column, simply click on the two arrows facing away from each other.
Select all the necessary columns and press ‘OK’ to get all the required data that was once in JSON format.
And there you have it. Four simple steps to change your JSON data into actual readable format within Power BI Desktop.
In case your JSON data contains nested data, there are some things to consider. In our table ‘OrderDetails_NestedJSON’, we have one record that contains nested JSON data. After copying the whole JSON and pasting it into the JSON online editor (https://jsoneditoronline.org/) you can see there are two extra variables in the Item variable.
This means we can expand the column, which is created with the ‘Parse JSON’ function, multiple times.
Expanding it once:
Expanding it twice:
Eventually after expanding it 5 times, we get all the necessary columns:
As you probably have noticed, the record with index ‘1’ appears four times now, due to expanding the nested JSON.
Something we could have predicted if we expanded all the variables in the online JSON editor. There we can see that there are two items for each order_id. Thus, creating four rows in Power BI Desktop.
Definitely something to keep in mind when expanding nested JSON data, as multiplying your records x-times in a table will decrease the performance of your Power BI Report. In addition to performance, this can also cause uncertain calculations, just because the rows are duplicated, and some things are counted twice.
© 2023 Kohera
Crafted by
© 2022 Kohera
Crafted by
Cookie | Duration | Description |
---|---|---|
ARRAffinity | session | ARRAffinity cookie is set by Azure app service, and allows the service to choose the right instance established by a user to deliver subsequent requests made by that user. |
ARRAffinitySameSite | session | This cookie is set by Windows Azure cloud, and is used for load balancing to make sure the visitor page requests are routed to the same server in any browsing session. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie records the user consent for the cookies in the "Advertisement" category. |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | CookieYes sets this cookie to record the default button state of the corresponding category and the status of CCPA. It works only in coordination with the primary cookie. |
elementor | never | The website's WordPress theme uses this cookie. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
__cf_bm | 30 minutes | Cloudflare set the cookie to support Cloudflare Bot Management. |
pll_language | 1 year | Polylang sets this cookie to remember the language the user selects when returning to the website and get the language information when unavailable in another way. |
Cookie | Duration | Description |
---|---|---|
_ga | 1 year 1 month 4 days | Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors. |
_ga_* | 1 year 1 month 4 days | Google Analytics sets this cookie to store and count page views. |
_gat_gtag_UA_* | 1 minute | Google Analytics sets this cookie to store a unique user ID. |
_gid | 1 day | Google Analytics sets this cookie to store information on how visitors use a website while also creating an analytics report of the website's performance. Some of the collected data includes the number of visitors, their source, and the pages they visit anonymously. |
ai_session | 30 minutes | This is a unique anonymous session identifier cookie set by Microsoft Application Insights software to gather statistical usage and telemetry data for apps built on the Azure cloud platform. |
CONSENT | 2 years | YouTube sets this cookie via embedded YouTube videos and registers anonymous statistical data. |
vuid | 1 year 1 month 4 days | Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. |
Cookie | Duration | Description |
---|---|---|
ai_user | 1 year | Microsoft Azure sets this cookie as a unique user identifier cookie, enabling counting of the number of users accessing the application over time. |
VISITOR_INFO1_LIVE | 5 months 27 days | YouTube sets this cookie to measure bandwidth, determining whether the user gets the new or old player interface. |
YSC | session | Youtube sets this cookie to track the views of embedded videos on Youtube pages. |
yt-remote-connected-devices | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt-remote-device-id | never | YouTube sets this cookie to store the user's video preferences using embedded YouTube videos. |
yt.innertube::nextId | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
yt.innertube::requests | never | YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen. |
Cookie | Duration | Description |
---|---|---|
WFESessionId | session | No description available. |