Skip to Content
Technical Articles
Author's profile photo Jens Braun

How to visualise processes in SAP Analytics Cloud using a funnel chart

Recently one of our customers asked me how a funnel chart can be integrated into a SAP Analytics Cloud story. Especially in sales reporting like lead-to-order, funnels are very good way to visualize the process from first customer contact to the sales order. This also applies to any other process visualization one might require.

At this moment SAP Analytics Cloud does not offer a funnel chart as part of its standard visualizations. Therefore, I wanted to show how to create a funnel chart using R visualizations in  stories. The possibility to use R visualizations in stories has been available for quite some time now (see also

Personally I found the plotly library the easiest way to build a funnel, there is nice introduction to funnels available, which was my main source of information.


The objective is to visualize data as a simple funnel with the possibility to match the colors to the theme of the story. The business case is to visualize the expected revenue as per current sales status. The data is taken from data model “SAP_Cloud4Customer”, which is provided in every SAP Analytics Cloud Tenant as part of the example data set “Management Dashboard”. You can activate this example data in your tenant via the Content Network.

The model contains the measure “number opportunities” and a status assignment in the dimension “Sales Phase”:



Create a new story, add the model “SAP_Cloud4Customer” to the story and create a new R visualization.
Then assign the necessary input data (“Sales Phase” and “Number Opportunities” from account filtered to Actual):


Now you are ready to enter the script and we will start off with a basic funnel by using the following code:


# build funnel:

fig <- plot_ly()

fig <- fig %>%


type = "funnel",

y = SAP_Cloud4Customer$`Sales Phase`,

x = SAP_Cloud4Customer$`Number Opportunities` )

# plot the funnel


This already provides a result:


However an alphabetic order of the phases is not what is required. Instead we need the semantic order of “Identify opportunity”, “Qualify opportunity”, “Develop value proposition”, “Quotation” and “Close”. So we need to arrange our data into the specific order.
This is done by applying a factor to the dimension “Sales Phase” and thus giving it the required order. The factor is defined by listing the values of “Sales Phase” in the required order:

SAP_Cloud4Customer$`Sales Phase` <- factor(SAP_Cloud4Customer$`Sales Phase`, levels = c("Identify opportunity", "Qualify opportunity", "Develop value proposition", "Quotation", "Close"))

Then rearrange the data using this factor:

SAP_Cloud4Customer <- SAP_Cloud4Customer %>% arrange(SAP_Cloud4Customer$`Sales Phase`)

This must be done before building the funnel and then we get the right order of data in the funnel:

This is nice and exactly what we need from a data point of view – except that the blue color scheme might not fit the colors used in the story.  It is not possible to reuse the color settings from the story, so colors have to be assigned manually in R. This is done by adding a marker to the funnel plot. Colors can be defined by name or Hex code. To apply the exact same colors to the funnel as in my story, I simply took the Hex codes from the continuous sequential color palette that I used in the story:

marker = list(color = c("#0d6499", "#405c8e", "#7b5382", " #c04974", " #f24269") )

Adding the marker to our funnel now provides a funnel that fits nicely into the overall story:

The final R script is as follows:


# brig data into requred format:
SAP_Cloud4Customer$`Sales Phase` <- factor(SAP_Cloud4Customer$`Sales Phase`, levels = c("Identify opportunity", "Qualify opportunity", "Develop value proposition", "Quotation", "Close"))
SAP_Cloud4Customer <- SAP_Cloud4Customer %>% arrange(factor(SAP_Cloud4Customer$`Sales Phase`, levels = c("Identify opportunity", "Qualify opportunity", "Develop value proposition", "Quotation", "Close")))

# build funnel:
fig <- plot_ly() 
fig <- fig %>%
  type = "funnel",
    textinfo = "value",  
  y = SAP_Cloud4Customer$`Sales Phase`, #dimension
  x = SAP_Cloud4Customer$`Number Opportunities`, #measures
  marker = list(color = c("#0d6499", "#405c8e", "#7b5382", " #c04974", " #f24269") ) ) 

# plot the funnel


It is possible to build a funnel chart in SAP Analytics Cloud using R visualizations. And the funnel chart provides a great way to visualize the current state of a process. It’s easy to start and get result and there are a lot more ways to layout the chart (please refer to the plotly funnel reference ( So go ahead and try it!

Assigned tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Witalij Rudnicki
      Witalij Rudnicki

      Very nice first blog post! I'm looking for more on DataViz 🙂

      Author's profile photo Kaushika Dutta
      Kaushika Dutta

      How do we overcome the limitations of using R visualisation ? like

      • The performance is very slow -loading time
      • Won't support in Mobile devices using the SAC app
      • Whenever any version upgrade happens, R Charts needs to be recreate
      Author's profile photo Jens Braun
      Jens Braun
      Blog Post Author

      Hello Kaushika,

      those are valid points. Regarding the performance using your own R server could be an option, but I do not have any experience here to say that this will surely help.
      I am not aware of any roadmap items to bring R visualisations to the mobile apps.

      And can you please share some more information on the version upgrade point? I have not yet experienced this behavior with my R visualisations - and I run them on a fast track tenant, so we have updates every two weeks.