Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear sir,
I am trying to calculate percentage from script but its showing wrong value.
can you help me to resolve it.
below is the script and screen shot of the output.
Load
'1' as Dom_PL_HCount,
Month(Booking_Date_All) as dom_TMonth,
Year(Booking_Date_All) as dom_TYEAR,
Gross_Sales_NonAir as dom_b2b2
Resident Ezeego where [Flag Air/Non-Air]='Non-Air' and Source='B2B' and [Flag International/Domestic]='Domestic';
Concatenate(dom_actual1)
Load
'5' as Dom_PL_HCount,
Month(Booking_Date_All) as dom_TMonth,
Year(Booking_Date_All) as dom_TYEAR,
Income as dom_b2b2
Resident Ezeego where [Flag Air/Non-Air]='Non-Air' and Source='B2B' and [Flag International/Domestic]='Domestic';
Concatenate(dom_actual1)
Load
'8' as Dom_PL_HCount,
dom_TMonth,
dom_TYEAR,
sum(if(Dom_PL_HCount='5',dom_b2b2))/sum(if(Dom_PL_HCount='1',dom_b2b2)) as dom_b2b2
resident dom_actual1 group by dom_TMonth,dom_TYEAR;
What is the expression you are using in this ?
sum(dom_b2b2)
What is the pupose of concatenating with the original table and again taking resident of it? This might also lead to improper values. Try this , concatenate the table which contains " '8' as Dom_PL_HCount" field and then take resident of " dom_actual1" and try your calculation.
Can you try use below expression
if(Dom_PL_HCount='8',num#(sum(dom_b2b2),'#,#0% ;'),sum(dom_b2b2))
Hi Pranali,
If you want a result set in percentage% use Aggregate functions in Expression instances of a script.
If you want use only in script , then use preceding load in script and aggregate data first and do , what you want result set according ?
can you share excel sheet with expected Output?
Thank you so much all for your quick reply. I Ressolved the Problem .
Share the solution, to make it useful to others.
And make it as Answered, close this thread.