Tuesday, October 27, 2020

PowerBI's HTML Content Visualization


For this post, we have an Excel:

We will load it using "Get Data" facility of PowerBI. If data is coming from a different source, for example, Snowflake: We use PowerBI's 'Get Data' again to pull the data:
Note above that we did not pass the protocol for 'Server' field such as 'https': We entered only: "survival8.west-europe.azure.snowflakecomputing.com" Because if "https://survival8.west-europe.azure.snowflakecomputing.com" is opened in the browser, it opens the Snowflake Worksheet. We will transform it in PowerBI as shown below:
In the 'Run R Script' window:
# 'dataset' holds the input data for this script dataset$derived_dt <- format(as.Date(dataset$datetime), '%Y-%m-%d') output <- dataset Press 'OK' and select 'Ignore Privacy Level Checks' in the next prompt.
Then go to 'Home' tab in the top ribbon and then click on first icon: 'Close & Apply' Add the custom visual 'HTML Content':
We will create this custom column to hold the HTML code derived from other columns. HTML = "<h1>" & 'Sheet1 (2)'[heading] & "</h1><h3>" & 'Sheet1 (2)'[subtext] & "</h3><<i style='color: red;'>" & 'Sheet1 (2)'[derived_dt] & "</i>"
Next, click the 'Tick Mark' to save it and drag the column 'HTML' into the 'HTML Content' view. View looks like this:
Note: the output is not in the same order as in the Excel sheet. You can find the PowerBI file, Excel file and HTML Content Visual File here: GitHub

No comments:

Post a Comment