cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Pareto chart in SAC

0 Kudos
2,198

Hello All,

I am facing a problem in creating a pareto chart in SAP Analytics cloud (SAC).

Que 1: I want to confirm whether we can create pareto charts in story mode using calculated measures and dimensions or we have to use some kind of scripting?

Que 2: I tried using R visualization to create pareto charts

The difficulties I am facing are

1. I am unable to group common supplier entries due to which deviation in the cumulative trend is visible.

2. Cannot introduce horizontal scroll bar due to which, for more number of entries chart is very cluttered.

3. I am not able to use dual axis due to which bottom % of suppliers are not even visible.

Attaching the screenshots and code used:

Code:

library(plyr)
library(dplyr)

library(plotly)


df<-data.frame(SPEND_ANALYTICS)


#Performing the descending sort
df <- df[order(df$SPEND, decreasing=TRUE), ]


#Converting the categorical variable to a factor()
df$Vendor <- factor(df$Vendor, levels = rev(unique(df$Vendor)), ordered=TRUE)



df$Percentage <- (df$SPEND*100)/sum(df$SPEND)
df$cumulative <- cumsum(df$Percentage) is.num <- sapply(df, is.numeric)
df[is.num] <- lapply(df[is.num], round, 3) df1 <- filter(df,df$cumulative <= Threshold3) df1
Count_vendors <- count(df1) library(ggplot2)



b <- ggplot(df1, aes(x=df1$Vendor)) +
geom_bar(aes(y=df1$Percentage), fill='blue', stat="identity") +
geom_point(aes(y=df1$cumulative), color = rgb(0, 1, 0), pch=16, size=1) +
geom_path(aes(y=df1$cumulative, group=1), colour="slateblue1", lty=3, size=0.9) +
theme(axis.text.x = element_text(angle=90, vjust=0.6)) +
ggtitle( paste( "No. of suppliers contributing top", Threshold3, "% Spend :", Count_vendors) )+
labs( subtitle = "", x = 'Suppliers', y =
'Percentage')

ggplotly(b)

Thanks in Advance..

View Entire Topic
mfoeken
Active Contributor

Hi Pratik,

By default SAC doesn't support a Pareto chart, nor in the story or via an analytic application. There are two ways to still add a Pareto chart:

  1. Use R (as you have already done);
  2. Create a custom widget.

Regarding the questions:

I think 1 and 3 have to be resolved as part of the R script and features a certain package offers for a Pareto chart. Perhaps you can try other supported libraries: https://www.sapanalytics.cloud/resources-r-packages/

Regarding question 2: you can only resize the R-visualization. There is no scrollbar for this object type in SAC, I believe.

Kind regards,

Martijn van Foeken | Interdobs

Hi Martijn,

I would surely go through the list of supported libraries. Try some different charting function.

Thanks for your support and quick reply. Really appreciate it.

Regards,

Pratik

0 Kudos

Hello Martijn, how can i draw pareto chart using custom widget? do you have any resource or example about doing it?

Thanks,