Categories
- All Categories
- 75 Oracle Analytics News
- 7 Oracle Analytics Videos
- 14K Oracle Analytics Forums
- 5.2K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 40 Oracle Analytics Trainings
- 59 Oracle Analytics Data Visualizations
- 2 Oracle Analytics Data Visualizations Challenge
- 3 Oracle Analytics Career
- 4 Oracle Analytics Industry
- Find Partners
- For Partners
Pivot table aggregates the LTV of opportunity based on Sales Stage, Yr Qtr- has duplicates
Trying to create a pivot table which aggregates the lifetime value of the opportunity based on the following:
1st: Per Sales Stage Name
2nd: Per Year Quarter (e.g. 2024 Q2)
Requirement in the pivot:
- Only 1 unique Stage Entry Lifetime Value per Opportunity and per Sales Stage.
- The Earliest Stage Entry Date per Opportunity and per Sales Stage is considered.
- Duplicate line items (Opportunity || Sales Stage Name) should only have LTV (Lifetime Value) from the earliest date
FOR THOSE LOOKING FOR SOME CHALLENGE.
Sample pivot table:
Sales Stage Name | 2024 Q1 | 2024 Q2 |
---|---|---|
Stage 1 | ||
Stage 2 | ||
Stage 3 |
Sample Data:
Opportunity number | Sales Stage Name | Stage Enter Date | Stage Enter Quarter | Lifetime Value (USD) | Stage Progression Active Flag |
---|---|---|---|---|---|
123 | Stage 1 | 1-Jan | 2024 Q1 | $ 200 | Y |
123 | Stage 2 | 1-Feb | 2024 Q1 | $ 300 | Y |
123 | Stage 3 | 1-Mar | 2024 Q1 | $ 400 | N |
123 | Stage 3 | 1-Apr | 2024 Q2 | $ 400 | Y |
456 | Stage 1 | 5-Feb | 2024 Q1 | $ 200 | Y |
456 | Stage 2 | 5-Mar | 2024 Q1 | $ 300 | N |
456 | Stage 2 | 5-Apr | 2024 Q2 | $ 300 | Y |
456 | Stage 3 | 15-May | 2024 Q2 | $ 400 | Y |
Pivot table result:
Opportunity number | 123 | ||
---|---|---|---|
Sum of Lifetime Value (USD) | Column Labels | ||
Row Labels | 2024 Q1 | 2024 Q2 | Grand Total |
Stage 1 | 200 | 200 | |
Stage 2 | 300 | 300 | |
Stage 3 | 400 |
| 800 |
Grand Total | 900 | 400 | 1300 |
Opportunity number | 456 | ||
---|---|---|---|
Sum of Lifetime Value (USD) | Column Labels | ||
Row Labels | 2024 Q1 | 2024 Q2 | Grand Total |
Stage 1 | 200 | 200 | |
Stage 2 | 300 |
| 600 |
Stage 3 | 400 | 400 | |
Grand Total | 500 | 700 | 1200 |
2 issues was encountered:
- Duplicated Lifetime Values
- For the Stage Enter Quarter, only the earliest Stage enter quarter should be considered:
- Opportunity number 123 - the $400 in 2024Q1 is correct vs the $800 from 2024Q1 and Q2 (duplicated)
- But since Opportunity number entered Stage 3 twice (2x), Lifetime Value for 2024 Q2 was added also, making the total to $800 instead of $400 only.
- Opportunity number 123 - the $300 in 2024Q1 is correct vs the $600 from 2024Q1 and Q2 (duplicated)
- But since Opportunity number entered Stage 3 twice (2x), Lifetime Value for 2024 Q2 was added also, making the total to $600 instead of $300 only.
Resolving the Issue#1: Duplicate Lifetime Values:
Using the "Stage Progression Active Flag" duplicate value is resolved by using this field in a calculation, using the following scenario using "CASE WHEN" sql statements:
- If the Stage Enter date is latest date(has Y value) , Lifetime Value is added to the pivot table
- If the Stage Enter date is not the latest date (has N value), Lifetime Value is 0.
Note: Lifetime value is also Y if the "Opportunity Number || Sales Stage name" line item is unique
Remaining issue:
Using the data in the first table, how to get only the line item with "earliest/first" stage enter date into the pivot table without having duplicate lifetime values?
====
Stage Entry Lifetime Value:
sum( CASE
WHEN "Sales Stage Name" = 'Stage 1'
and "Stage Progression Active Flag" = 'Y'
THEN "Table for Lifetime Value Stage 1"
WHEN "Sales Stage Name" = 'Stage 2'
and "Stage Progression Active Flag" = 'Y'
THEN "Table for Lifetime Value Stage 2"
WHEN "Sales Stage Name" = 'Stage 3'
and "Stage Progression Active Flag" = 'Y'
THEN "Table for Lifetime Value Stage 3"
ELSE 0 END)
==
Also added this filter:
"Stage Enter Date" = (min("Stage Enter Date" by ."Opportunity Number", ""Sales Stage Name" ) )
==
However, my understanding is that calculation comes first before the visualization filter. As a result, the filter has no effect on the results.
Please let me know your thought on this. Thank you!
Answers
-
Hi,
You maybe see that the rendering of your "tables" (or pivot) in your post is not very good.
Consider posting a screenshot (Excel is an amazing tool for showing what you have, what you expect instead etc.) of the pivots you try to show instead of the HTML/forum version of a table.
This could make your question more readable and get you some replies.
0 -
Thanks Gianni for those suggestions!
@User_OS6BE, other good ways to get responses include tagging people with the "@" sign, so they get notified, or raising a Service Request for your 2nd issue.
0 -
Hi Cristina,
I have responded to you on this query and believe you have the answers.Essentially, we have used the OAC provided 'Aggregation Method' and 'Aggregation By' for the metric and get the desired outcome.
0