SAP Analytics Cloud R Visualization feature allows users to integrate their own R environment into SAP Analytics Cloud. R is an open-source programming language that includes packages for advanced visualizations, Statistics, Machine Learning and much more.

With this new integration in SAP Analytics Cloud, you can now:

  • Insert R-visualizations into your story
  • Interact with R-visualizations using SAP Analytics Cloud-controls (such as filters)
  • Share these SAP Analytics Cloud stories, which include R-visualizations, with other users.

With the R visualization capability, users are able to perform statistical and analytical analyses and create truly captivating visuals to reflect these analyses. Also, it is important to note that these visualizations remain interactive and consider the row-level security of users.

Let’s take a look at a use case how an analyst in an international software company can use the R Visualization feature in SAP Analytics Cloud for their sales analysis and forecast.

Prerequisites:

In order to perform the analysis with R visualization, you will need to set up and configure your R Server to connect to SAP Analytics Cloud. Please refer to this blog for the detailed steps to set up your R server connection.

You will also need to have a model created and data imported in SAP Analytics Cloud in order to apply the R visualization. For details on setting up your model and other preparation steps, please refer to part I of this blog.

Now, we have finished all the preparation steps for us to start doing sales analysis with SAP Analytics Cloud R Visualization. In this blog, we will do the following two analysis:

  • Detailed analysis of Sales/Cost Trend via time (where the analyst wants to explore the sales trend over time for software and service in order to leverage its data with R visualization.)
  • Detailed Customer Analysis (where the analyst wants to see the details of the company’s customer base and how it changes over time-based on different measures).

These examples help illustrate how to leverage the R-Visualization feature of SAP Analytics Cloud to do the real business analysis. As we can see, the feature is able to provide a lot more flexibility on visualization and business intelligence.

Analysis #1: Sales/Cost Trend via Time

As the technology industry moving from traditional on-premise software to the cloud, the analyst wants to take a look how that trend affects the sales of the company.

First, the analyst wants to explore the Sales Trend over time for Software and Service, and he follows the steps below in order to leverage its data with R visualization:

  1. Create a new story
  2. Add a new Canvas Page.
  3. Create an R Visualization on the Story Canvas.
  4. On the Story page, click on “+ Input Data” and select the data model of your choice (in this case, it will be SoftwareSales_ABCCompany).
  5. Add Dimensions as shown below, Filters (e.g. from the Data Frame Panel, Story and Page Filters). Click on the “Fullscreen” button on the Data Frame Panel to see the Table Preview (view-only)
  6. Click “OK” or “Cancel” button to close the panel.
  7. Click on “Add Script” and expand the panel to full screen. 
  8. Input R Script in the “Editor” section. Below is a sample R code you could use:
    library(dplyr)
    library(ggplot2)
    
    SoftwareSales_ABCCompany$Time = as.Date(SoftwareSales_ABCCompany$Time)
    bytime <- SoftwareSales_ABCCompany %>%
      group_by(Time) %>%
      summarise(Sales_On_Premise = sum(Sales_Software_On_Premise), Sales_Cloud = sum(Sales_Software_Cloud),
                Sales_Software = sum(Sales_Software_On_Premise + Sales_Software_Cloud), 
                Sales_Service = sum(Sales_Service_Consulting + Sales_Service_Customer_Success)) 
    
    ggplot(bytime, aes(x = Time)) +
      geom_line(aes(y = Sales_Software/1000, colour = "Software"), size = 1) + 
      geom_line(aes(y = Sales_Service*4/1000, colour = "Service"), size = 1) + 
      scale_y_continuous(sec.axis = sec_axis(~./4, name = "Sales Service ($000)")) +
      scale_colour_manual(values = c("turquoise3", "salmon")) + 
      labs(y = "Sales Sofware ($000)", x = "Year", colour = "Category")​
  9. Click “Execute” button to run the script and you will see the chart generated in the “Preview” section of the window
  10. Click “Apply” to insert the chart in to your story.

From the chart above, we can see that in the recent years, the Software sales has been relatively flat, where the Service sales have been increasing steadily over the last five year. This aligns with the typical trend in a cloud environment where revenue recognition is delayed, and it also shows the increasing demand in the market for professional software service.

Next, let’s take a deep dive in the software sales to see how each component of it has been changed over years.

Follow the same steps in our previous section to generate a new chart by using the following R-Code

library(dplyr)
library(ggplot2)

SoftwareSales_ABCCompany$Time = as.Date(SoftwareSales_ABCCompany$Time)
bytime <- SoftwareSales_ABCCompany %>%
  group_by(Time) %>%
  summarise(Sales_On_Premise = sum(Sales_Software_On_Premise), Sales_Cloud = sum(Sales_Software_Cloud),
            Sales_Software = sum(Sales_Software_On_Premise + Sales_Software_Cloud), 
            Sales_Service = sum(Sales_Service_Consulting + Sales_Service_Customer_Success)) 

ggplot(bytime, aes(x = Time)) +
  geom_line(aes(y = Sales_Cloud/1000, colour = "Cloud Software"), size = 1) + 
  geom_line(aes(y = Sales_On_Premise/1000, colour = "On Premise Software"), size = 1) + 
  scale_colour_manual(values = c("turquoise3", "salmon")) + 
  labs(y = "Sales ($000)", x = "Year", colour = "Category")

From the chart above, we can easily found out that the traditional on-premise software sales has been going down and the cloud software sales are taking the lead in sales during the last five years.

In Conclusion, same with the industry trend,  Cloud software, as well as services associated with it, are driving the revenue of the company.

Analysis #2: Customer Analysis

As an analyst, you may also want to see the details of the company’s customer base and how it changes over time based on different measures.

First, we can follow the same steps as mentioned previously to execute the following R-Code in SAP Analytics Cloud.

library(ggplot2)
library(reshape2)
library(dplyr)

SoftwareSales_ABCCompany$Time = as.Date(SoftwareSales_ABCCompany$Time)
bysector <- SoftwareSales_ABCCompany %>%
  filter(Time == max(SoftwareSales_ABCCompany$Time)) %>%
  group_by(`Customer Sectors ABCCompany`) %>%
  summarise(Sales_On_Premise = sum(Sales_Software_On_Premise), Sales_Cloud = sum(Sales_Software_Cloud))


mbysector <- melt(bysector, id.vars = "Customer Sectors ABCCompany")

ggplot(mbysector, aes(x = factor(`Customer Sectors ABCCompany`, levels = bysector$`Customer Sectors ABCCompany`[order(-bysector$Sales_On_Premise/bysector$Sales_Cloud)]), 
                      y = value, fill = factor(variable))) + 
  geom_bar(position="fill", width = 0.8, stat="identity") + coord_flip() + labs(x = "Sector", y = "Proportion") +
  scale_fill_discrete(name = "Category")

and you will be able to generate a chart shown below

From the chart above, we can see that On-Premise software sales still count for large chunk sales for traditional value industries such as Industrial, where the growth industries such as High Tech are moving faster to the cloud.

Second, we can also take look at customer size VS customer number in terms of revenue contribution to the company.

Again, we can follow the same steps and R-code below to see the insight.

library(dplyr)
library(ggplot2)
library(grid)
library(gridExtra)

bysegment <- SoftwareSales_ABCCompany %>%
  group_by(`Customer Segments ABCCompany`) %>%
  summarise(customer_number = n()/50, sales = sum(Sales_Software_On_Premise + Sales_Service_Consulting, 
                                                  Sales_Software_Cloud, Sales_Service_Customer_Success))

bysegment$Customer.Segment <-  factor(bysegment$`Customer Segments ABCCompany`, 
                                    levels = bysegment$`Customer Segments ABCCompany`[order(-bysegment$customer_number)])


g.mid <- ggplot(bysegment, aes(x = 1, y = Customer.Segment)) + geom_text(aes(label = Customer.Segment))+
  geom_segment(aes(x = 0.94, xend = 0.96, yend = Customer.Segment)) +
  geom_segment(aes(x = 1.04, xend = 1.065, yend = Customer.Segment)) +
  ggtitle("") + ylab(NULL) + scale_x_continuous(expand = c(0, 0), limits = c(0.94, 1.065)) +
  theme(axis.title = element_blank(), panel.grid = element_blank(), axis.text.y = element_blank(),
        axis.ticks.y = element_blank(), panel.background = element_blank(), axis.text.x = element_text(color = NA),
        axis.ticks.x = element_line(color = NA), plot.margin = unit(c(1, -1, 1, -1), "mm"))

g1 <- ggplot(data = bysegment, aes(x = Customer.Segment, y = customer_number)) +
  geom_bar(stat = "identity", width = 0.8, fill = "turquoise3") + ggtitle("Number of Customers") +
  theme(axis.title.x = element_blank(), axis.title.y = element_blank(), axis.text.y = element_blank(), 
        axis.ticks.y = element_blank(), plot.margin = unit(c(1, -1, 1, 0), "mm")) +
  scale_y_reverse() + coord_flip()

g2 <- ggplot(data = bysegment, aes(x = Customer.Segment, y = sales/1000)) + xlab(NULL)+
  geom_bar(stat = "identity", width = 0.8, fill = "salmon") + ggtitle("Sales Total ($000)") +
  theme(axis.title.x = element_blank(), axis.title.y = element_blank(), axis.text.y = element_blank(), 
        axis.ticks.y = element_blank(), plot.margin = unit(c(1, 0, 1, -1), "mm")) +
  coord_flip()


gg1 <- ggplot_gtable(ggplot_build(g1))
gg2 <- ggplot_gtable(ggplot_build(g2))
gg.mid <- ggplot_gtable(ggplot_build(g.mid))

grid.arrange(gg1, gg.mid, gg2, ncol = 3, widths = c(4/9, 1/9, 4/9))

and the generated chart will look like the screenshot below:

From the chart, we can see that even though the large size customers (Fortune 500) are only a small portion of the entire customer base, it actually generate the majority revenue of the company. It will give the higher management of the company some hints on how to better manage their customers and diversify their revenue sources.

It is a small story to tell regarding how to leverage the R-Visualization feature of SAP Analytics Cloud to do the real business analysis. As we can see, the feature is able to provide a lot more flexibility on visualization and business intelligence.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply