Sometimes as a SAC developer you would receive request from your business team to build dashboards encapsulating an aggregation function like runningsum(). This blog covers a specific case wherein

  1. The scope is limited to SAC acquired connections involving an SAC model creation (rather than live connections). This specific case if pertaining but not limiting to OData service as source.
  2. We are trying to achieve the cumulative sum in a chart rather than a table (wherein we have inbuilt cumulative functions).
  3. The cumulative sum should be continuous and can seamlessly across year boundaries E.g. Dec 2020 through Jan 2021 etc. This would rule out the use of YTD, MTD etc. aggregation calculation leveraged in time series plots

Sample Use case: Showing daily count of defects opened during HyperCare phase of a project along with a running sum of backlog. Here:

  1. Defects opened = Number of defects opened per day
  2. Defect Backlog = A – B = sum (All tickets opened till date) – sum (All tickets closed till date)

Even though we do not have an equivalent out of the box cumulative aggregation function to leverage in a user defined variable, SAP Analytics Cloud still gives us the flexibility of simulating the function at a model level.

Here, the approach is two-fold

Step1: F1 = Calculate A-B at daily level (@SAC Model)

Step2: F2 = Apply LOOKUP() function on the above calculation i.e. F1(@SAC Model)

Navigate to the Model >Account > Add Member (under Edit) > Add Formula for the Member

Account%20dimension

Account dimension

The respective columns for Step1 and Step2 are then created as members of account dimension

Column%20containing%20the%20Lookup%20Function%20is%20created%20as%20an%20Account%20dimension%20member

Columns ‘Backlog’ and ‘Backlog_Weekly’ containing the Lookup Function is created as an Account dimension members

 

Now, let us understand the LOOKUP function to code for step 2

Decoding the Lookup function for cumulation functionality:

Part1: Overview of LOOKUP function

The LOOKUP function is used to aggregate the account member in the context of a given point of  view (POV). Click here to learn more about the function from SAP Help Portal

Syntax: LOOKUP([<account member>], [<POV>], [<Ignore Dimension>])

Part2: Writing Dynamic time navigation functions for given POV

Backlog = [ Open Incident Count] – [Resolved Incident Count]

LOOKUP([Backlog] ,[d/Week_End_Date]=Lastperiods(“Day”,365 ))

The ‘Lastperiods’ time navigation function is the key to cumulate the daily backlog values. Here, we have restricted the cumulation to 365 days of a year, Ideally this value would vary depending upon the requirement and can be changed accordingly. The output of the function is shown below.

Cumulation%20Output%20%28line%29

Cumulation Output. X-Axis  = Week End Date; Y-Axis = Opened Tickets (Bar) and Backlog (line)

 

In the above chart, the blue bar represents the opened tickets at a weekly level. The orange line represents the cumulation output of the LOOKUP function

E.g.

Open Tickets for week of March 29th =6   –> (A)

Resolved tickets for week of April 5th = 0 –>(B)

Open Tickets for week of April 5th = 4 –>(C)

Backlog for Week of April 5th =  (A)-(B)+(C) = 6-0+4 = 10

Here the LOOKUP function cumulates all open tickets (for 3/22 , 3/29, 4/5) then substracts all closed tickets (for 3/22 , 3/29, 4/5) to simulate the above number (10). This is because the it acts on top of the Account member Backlog = [ Open Incident Count] – [Resolved Incident Count]

In this way we can centralize the cumulation at a model level which can then be leveraged across multiple dashboards.

Regards,

Dhyanesh

 

 

 

 

 

 

Randa Khaled

Randa Khaled

Author Since: November 19, 2020

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x