Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qliklearnervir
Creator
Creator

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
Specialist III
Specialist III

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
Creator
Creator

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