Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

qliklearnervir
New Contributor III

mathematical calculation in Qlik script

Hi,

We have one of the requirements where our data looks like below:

     

IDBooking ActualTotal SeatsBudget ActualTotal  budget rooms
11200511504
27803840

3

and we want to calculate formula in a script itself.

% Revenue= (sum(BookingActual)/sum(Total Seats) - sum(BudgetActual)/sum(Totalbudgetrooms)) / sum(BudgetActual)/sum(Totalbudgetrooms)

please suggest the same.

2 Replies
mdmukramali
Valued Contributor II

Re: mathematical calculation in Qlik script

Hi,

if you want to Calcualte for each row % Revenue then you can use.

(([Booking Actual]/[Total Seats])-([Budget Actual]/[Total  budget rooms]))/[Budget Actual]/[Total  budget rooms] as Revenue.

if you have multiple rows for same ID then you have to use group by function .

let me know if you need something more.

vikraant
Contributor

Re: mathematical calculation in Qlik script

Hi Virendra,

You can use the formula you have mentioned , aggregating the values by ID.

Load

    ID,

   (sum(BookingActual)/sum(Total Seats) - sum(BudgetActual)/sum(Totalbudgetrooms)) / sum(BudgetActual)/sum(Totalbudgetrooms)  as [%Revenue]

Group By ID  ; ....

Check if this is possible in your data model.

Best Regards,

Vikraant

Community Browser