Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I would like to create a new function that I can use to display in a statistics box. Basically the function would do this equation:
(Total No. Hours) x (Hourly Rate) = Total Service Pay
I was trying this lines on the script but can't seem to make it work.
Sum([# of Hours]) as TotalHours
Sum([# of Hours])*[Hourly Rate] as TotalServicePay
I guess making a function is better. So I can display it on a statistics box.
Hi Charles,
Try this on the Statistics Box
Sum(Aggr(Sum([# of Hours]*[Hourly Rate]),[Personnel Name]))
Regards!!
Hi Charles,
Could you attach your script?
Regards
Miguel del Valle
When you use Aggregation functions in script you need Group By clause in the load statement, can you share your script code to understand and also share what problem you are facing.
Hi, if you do this on your script?
([# of Hours])*[Hourly Rate] as TotalServicePay
We really need to see the whole load statement to understand where the problem lies...
Something like this -
Load A,
Sum(B) as B1,
Sum(C) as C1,
D
from test.qvd
group by A,D;
ps. An immediate issue is that you are not aggregating the 'Hourly rate' field... you need to multiply before the sum (adding dimensions etc. in group by clause and load)
Load
sum(Pay) as Total Pay
...
;
Load
[# of Hours]*[Hourly Rate] as Pay
...
Hi Everyone,
Thanks for your response. Attached is here is the script. I was trying to add these lines at the end of the script. Not sure if I'm doing it right.
DataResults:
LOAD [# of Hours]
Sum([# of Hours]) as TotalHours,
Sum([TotalHours])*[Hourly Rate] as TotalServicePay;
Hi Charles,
Try this on the Statistics Box
Sum(Aggr(Sum([# of Hours]*[Hourly Rate]),[Personnel Name]))
Regards!!
Hi Manuel,
Thanks! It worked. Aggr( ) did the job.