Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
My first(Second) post hopefully you guys can help
Firstly I am struggling and relatively new so haven't really hot the Variables under the belt yet; so I apologize for the very long expressions.
The Business Case:
To firstly summarize the business case itself
Trying to calculate a Percentage Revenue Split from Preset set analysis for Telephone Minutes Spend.
There is a total Data bundle package sold that has a complete revenue potential that has usage, that is subtracted monthly from the total potential Revenue.
I have two commission earning entities one that gets a set amount; another that gets 30% off everything that is left off the profit,
as a benefit off being the billing agent.
Base Calculation: (This works fine)
Basically I have a Calculation based on three set analyses that give me an value:
((<//Total Free Minutes Potential Revenue> LESS <//Carbon Cost >LESS <//Dealer Commissions In_Bundle> )) * 30% = <Profit_Share>
Anything within the //Comments as mentioned I haven't managed to get myself into a proper working variable yet but it seems to work ok. except for one issue.
///////////////////START
(Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.name] = {"FREEDOM*"}>}(RIGHT([Volume_Discount_Plans.name], Len([Volume_Discount_Plans.name])-8)))*0.31
-
//Carbon Cost
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},i_vendor={32,35,36,39,40},[Services.name]={"Voice Calls"}>}[CDR_Vendors.charged_amount]+(charged_quantity/60)*0.04)
-
//Dealer Commisions In_Bundle
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.description] = {"INBUNDLECOMMISSION*"}>}(RIGHT([Volume_Discount_Plans.description], Len([Volume_Discount_Plans.description])-19)))
)*0.3)
///////////////////END
The Problem:
That Calculation on it's own works fine except that occasionally on this business case I end up with a negative values;
This is due to the Sum off <Carbon_Cost> and <Dealer Commissions In_Bundle> Occasionally exceeded.
Now if this happens the is no 'Proverbial Claw Back' <The Profit_Share> should really just be zeroed instead. ie
IF
((<//Total Free Minutes Potential Revenue> LESS <//Carbon Cost >LESS <//Dealer Commissions In_Bundle> )) * 30% <= 0
DONT SUM IT ELSE SUM IT <Profit_Share>
I have managed to accomplish what I need from an IF Statement but this does NOT seem to be very friendly to attach to a bar chart.
Thanking any assistance in advance
The IF Statement In question; that
The IF Statement I would Like to convert into a 'Pure' Set Analysis
IF(
//////EXPRESSION To ANALYSE START
//Total Free Minutes Potential Revenue
(Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.name] = {"FREEDOM*"}>}(RIGHT([Volume_Discount_Plans.name], Len([Volume_Discount_Plans.name])-8)))*0.31
-
//Carbon Cost
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},i_vendor={32,35,36,39,40},[Services.name]={"Voice Calls"}>}[CDR_Vendors.charged_amount]+(charged_quantity/60)*0.04)
-
//Dealer Commisions In_Bundle
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.description] = {"INBUNDLECOMMISSION*"}>}(RIGHT([Volume_Discount_Plans.description], Len([Volume_Discount_Plans.description])-19)))
)*0.3
///// EXPRESSION To ANALYSE END
< 0, ////LESS THATN ZERO
0, /// MAKEZERO IF LESS THAN ZERO ELSE SUM
(Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.name] = {"FREEDOM*"}>}(RIGHT([Volume_Discount_Plans.name], Len([Volume_Discount_Plans.name])-8)))*0.31
-
//Carbon Cost
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},i_vendor={32,35,36,39,40},[Services.name]={"Voice Calls"}>}[CDR_Vendors.charged_amount]+(charged_quantity/60)*0.04)
-
//Dealer Commisions In_Bundle
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.description] = {"INBUNDLECOMMISSION*"}>}(RIGHT([Volume_Discount_Plans.description], Len([Volume_Discount_Plans.description])-19)))
)*0.3) ///////ELSE HONOR THE EXPRESSION
Bump
Hi,
first :
may be use rangemax(0, your expression)
second :
try to use variable externalized rather than hard coded (0,31 0,04 , 300 .....
regards
Hi Oliver
Thank you for the response
On First:
It only returns (0) on the chart
rangemax(0,
(//Total Free Minutes Potential Revenue
(Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.name] = {"FREEDOM*"}>}(RIGHT([Volume_Discount_Plans.name], Len([Volume_Discount_Plans.name])-8)))*0.31
-
//Carbon Cost
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},i_vendor={32,35,36,39,40},[Services.name]={"Voice Calls"}>}[CDR_Vendors.charged_amount]+(charged_quantity/60)*0.04)
-
//Dealer Commisions In_Bundle
Sum({$<[Custom_Field_Values.i_custom_field]={'300'}, value = {'Yes'},[Volume_Discount_Plans.description] = {"INBUNDLECOMMISSION*"}>}(RIGHT([Volume_Discount_Plans.description], Len([Volume_Discount_Plans.description])-19)))
)*0.3)
)
Second: (not sure if it influences the result?)
Please confirm if my understanding is correct: should I create variables for each numeric values
ie {32,35,36,39,40} should be {vOutgouingVendor} (AFter creating it a variable for the number set and
19 should be {Var19}
and 300 should be {vCustomfield1}?
brian,
put each sum as an expression, maybe a problem for one of them
for second point it's a general recommandation for a readable code, yes for your variables with $(var)
Will give it a try
Ok I think I see the problem but don't know how to fix it....
The first expression is not always higher than the combination of the latter two depending on the conditions met per customer.
ie Customer 1 may end up as a negative when the calculation is done
Customer 2 could end up as a positive.
Customer 3 may end up as negative
Customer 4 May end up as positive
I am only interested the Total Sum higher than zero for Customer 2 and Customer 4.
The balance should be ignored in the graph in totality.
I suspect I somehow need to make all three sum expressions one SUM expression?
Any further advise would be appreciated
Hi Oliver
You were indeed right; there is a problem with two off the sum expressions.
I'll work on these separately; thank we can mark this solved