Viva Insights
Power BI is a powerful business analytics tool that can help organizations make informed decisions based on their data. With the introduction of Viva Insights, Microsoft’s employee experience platform, users can now easily visualize and analyze workplace data within Power BI. In this article, we will discuss the Power Query M language code that is required to connect to the Viva Insights data source from inside Power BI.
Understanding Viva Insights Data Source
Before we dive into the technical details of connecting to Viva Insights from Power BI, let’s first understand what Viva Insights is and what kind of data it provides. Viva Insights is an employee experience platform that provides insights into employee engagement, productivity, and well-being. It collects data from different sources such as Microsoft 365, LinkedIn, and GitHub, and provides a unified view of workplace analytics.
The Viva Insights data source in Power BI provides access to data related to the following areas:
– Well-being: Provides data related to well-being, such as meditation minutes, focus hours, and network meetings.
– Collaboration: Provides data related to collaboration, such as email, chat, and Teams activity.
– Productivity: Provides data related to productivity, such as work hours, focus hours, and after-hours work.
– Network: Provides data related to network, such as number of meetings, number of attendees, and response time.
Connecting to Viva Insights Data Source
To connect to the Viva Insights data source from inside Power BI, you need to follow these steps:
1. Open Power BI Desktop and click on “Get Data” from the Home tab.
2. In the “Get Data” window, select “More” from the “To a Server” section.
3. In the “From Other Sources” section, select “Power Query” and click on “Connect”.
4. In the “Power Query Editor”, click on “New Source” and select “Web”.
5. In the “From Web” window, enter the URL of your Viva Insights data source. The URL should be in the following format: https://orgname.viva.office.com/api/data.
6. Click on “OK” and wait for the data to load.
7. Once the data is loaded, you can transform and shape the data as per your requirement.
Power Query M Language Code for Connecting to Viva Insights Data Source
Now that we have understood the steps to connect to the Viva Insights data source from Power BI, let’s take a closer look at the Power Query M language code that is required to establish this connection.
The following Power Query M code can be used to connect to the Viva Insights data source:
let
Source = Json.Document(Web.Contents("https://orgname.viva.office.com/api/data")),
data = Source[value],
#"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"Timestamp", "Metric", "Value", "Tags"}, {"Timestamp", "Metric", "Value", "Tags"}),
#"Expanded Tags" = Table.ExpandRecordColumn(#"Expanded Column1", "Tags", {"Name", "Value"}, {"Name", "Value"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Tags",{"Tags"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Timestamp", type datetime}, {"Value", type number}})
in
#"Changed Type"
In this code, we first use the “Json.Document” function to retrieve the data from the Viva Insights data source. We then transform the data into a table format using the “Table.FromList” function. Finally, we expand the columns to retrieve the required fields.
Conclusion
In conclusion, connecting to the Viva Insights data source from inside Power BI involves a few simple steps. With the Power Query M language code provided above, you can easily establish a connection and retrieve the required data. This data can then be transformed and visualized as per your organization’s requirements. The insights provided by Viva Insights can help organizations improve employee engagement, productivity, and well-being, making it a powerful tool for any organization.